-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MF 1413 - Use per-service URL in SDK #1444
Conversation
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #1444 +/- ##
==========================================
+ Coverage 70.86% 70.90% +0.03%
==========================================
Files 123 123
Lines 9600 9564 -36
==========================================
- Hits 6803 6781 -22
+ Misses 2270 2256 -14
Partials 527 527
Continue to review full report at Codecov.
|
@@ -160,7 +160,7 @@ func dec(in []byte) ([]byte, error) { | |||
func newService(auth mainflux.AuthServiceClient, url string) bootstrap.Service { | |||
things := mocks.NewConfigsRepository() | |||
config := mfsdk.Config{ | |||
BootstrapURL: url, | |||
ThingsURL: url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ThingsURL
? It looks that caller is calling this newService()
funtion with the URL of Bootstrap server, right? And we are giving this to ThingsURL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ThingsURL
is used to reach things
service API endpoints.
Bootstrap test server is created after newService
with
bs := newBootstrapServer(svc)
and then you can test bootstrap endpoints using bs.URL
for _, tc := range cases {
req := testRequest{
client: bs.Client(),
method: http.MethodPost,
url: fmt.Sprintf("%s/configs", bs.URL),```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming of these functions is confusing. Calling something called newService()
inside of Boostrap code, I would expect that it gives me back Boostrap service.
Also, take a look at the callers - what URLs do they provide? URLs of Things? How do you know where Things is - this is something that user should tell you via ENV var, no?
@@ -65,7 +65,7 @@ func newService(tokens map[string]string) (certs.Service, error) { | |||
|
|||
auth := thmocks.NewAuthService(tokens) | |||
config := mfsdk.Config{ | |||
CertsURL: server.URL, | |||
ThingsURL: server.URL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this server
? Is it Bootstrap server? If yes - why we are giving this URL to Things service configuration - in realistic deployment these will be two completely different URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server
here is http server serving API calls to things service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, serving HTTP API of a Bootstrap service, i.e. it is a Bootstrap service httptest
server. This is why I am saying that this is fundamentally wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not bootstrap, but things
bootstrap/service_test.go
Outdated
@@ -58,6 +58,7 @@ func newService(auth mainflux.AuthServiceClient, url string) bootstrap.Service { | |||
things := mocks.NewConfigsRepository() | |||
config := mfsdk.Config{ | |||
BootstrapURL: url, | |||
ThingsURL: url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answer is similar as above, additionaly providing ThingsURL
here is configuring bootstrap service so that it can reach things
service API endpoints to create things, channels, check connections
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
@@ -102,12 +102,3 @@ rundev: | |||
run: | |||
docker-compose -f docker/docker-compose.yml up | |||
|
|||
runlora: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this clutter because it is rarely launched and should be documented somewhere and not burden the main Makefile.
-f docker/addons/lora-adapter/docker-compose.yml up \ | ||
|
||
# Run all Mainflux core services except distributed tracing system - Jaeger. Recommended on gateways: | ||
rungw: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be useful, but again - rarely used. Should be rather documented somewhere and executd manually when needed.
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
bootstrap/service_test.go
Outdated
@@ -57,7 +57,8 @@ var ( | |||
func newService(auth mainflux.AuthServiceClient, url string) bootstrap.Service { | |||
things := mocks.NewConfigsRepository() | |||
config := mfsdk.Config{ | |||
BaseURL: url, | |||
BootstrapURL: url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need this BootstrapURL
TLSVerification: false, | ||
ThingsURL: ts.URL, | ||
MsgContentType: contentType, | ||
TLSVerification: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we perform tests with TLSVerification = true
provision/configs/config.toml
Outdated
tls = true | ||
users_location = "" | ||
users_url = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not defaulting to the correct Users' service URL? Also, TLS is on, but URLs are http
.
Update tests, remove linter warnings, remove dead code. Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com>
* Use per-service URL in SDK Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com> * Fix CLI Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix CLI messaging Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix message tests Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Simplify Bootstrap Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Update API doc and responses Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * fix failing certs, bootstrap tests Signed-off-by: mteodor <mirko.teodorovic@gmail.com> * fix failing certs, bootstrap tests Signed-off-by: mteodor <mirko.teodorovic@gmail.com> * Fix tests and rename to auth service Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Clean the code Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Remove unnecessary Repository logs Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Always return error in case of repo failure Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Cleanup SDK and CLI Update tests, remove linter warnings, remove dead code. Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Clean the code Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Undo Bootstrap changes Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix tests Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix linter Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> Co-authored-by: mteodor <mirko.teodorovic@gmail.com> Co-authored-by: dusanb94 <dusan.borovcanin@mainflux.com> Signed-off-by: Burak Sekili <buraksekili@gmail.com>
* Use per-service URL in SDK Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com> * Fix CLI Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix CLI messaging Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix message tests Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Simplify Bootstrap Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Update API doc and responses Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * fix failing certs, bootstrap tests Signed-off-by: mteodor <mirko.teodorovic@gmail.com> * fix failing certs, bootstrap tests Signed-off-by: mteodor <mirko.teodorovic@gmail.com> * Fix tests and rename to auth service Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Clean the code Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Remove unnecessary Repository logs Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Always return error in case of repo failure Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Cleanup SDK and CLI Update tests, remove linter warnings, remove dead code. Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com> * Clean the code Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Undo Bootstrap changes Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix tests Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> * Fix linter Signed-off-by: Drasko Draskovic <drasko.draskovic@gmail.com> Co-authored-by: mteodor <mirko.teodorovic@gmail.com> Co-authored-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Drasko DRASKOVIC drasko.draskovic@gmail.com
What does this do?
Fixes SDK to use per-service URL instead of
BaseURL
.Which issue(s) does this PR fix/relate to?
Resolves #1413