-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: Fix to make mender-connect request a new JWT token on its own, so its not dependent on mender-update to do so #134
base: master
Are you sure you want to change the base?
Conversation
@SebOpsahl, Let me know if you want to start the integration pipeline by mentioning me and the command "start pipeline". my commands and optionsYou can trigger a pipeline on multiple prs with:
You can start a fast pipeline, disabling full integration tests with:
You can trigger GitHub->GitLab branch sync with:
You can cherry pick to a given branch or branches with:
|
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.
The fix looks good to me. Have you experimented a bit with the fix on a QEMU run? I think this deserves some manual testing also on top of our tests, for good measure.
See my comments below.
One other thing: the changelog deserves a bit more info. I would keep the commit title short, and write a longer entry that describes more of the historical reason for this. For example:
Fix bla bla bla.
Previously, mender-connect
relied the Mender client to request new JWT tokens. Since the split of mender
into mender-update
and mender-auth
, it is theoretically possible to run mender-connect
without mender-update
, in which case it wouldn't request JWT tokens without this fix.
client/mender/auth.go
Outdated
@@ -33,7 +33,7 @@ const ( | |||
|
|||
var timeout = 10 * time.Second | |||
|
|||
// AuthClient is the interface for the Mender Authentication Manager clilents | |||
// AuthClient is the interface for the Mender Authentication Manager clients |
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 should go on a different commit.
Specially for fixes, where we might need to cherry-pick the fix to supported branches, we don't want a typo fix to be in the way.
ac6db0c
to
d7063f8
Compare
Yes I have manually tested it with a QEMU run with yocto on mender integration to ensure it behaves as it should during running. |
I fixed the requests you made, so it should look good now. Good catches, thanks :) |
|
4521af3
to
d8556ae
Compare
@mender-test-bot start pipeline |
Hello 😺 I created a pipeline for you here: Pipeline-1201262197 Build Configuration Matrix
|
When running the big test the “test:acceptance:qemux86_64:uefi_grub:cross-platform” test fails, even though “test:acceptance:qemux86_64:uefi_grub” does not. So some of the cross-platform tests fail and returns the following errors, which seems to be due to loss of connection.
How may it be that it works for the other tests, but not testing for cross platform? |
The test is only run for that platform. If you look into the details of the test report you will find them mark as The name might be confusing, but the "cross platform" tests are the ones that are independent of the platform so we run them only once. The tests at hand are runtime tests for the mender-connect software, so these we consider "cross platform" because it doesn't matter how you integrate Mender on the platform, the software will run the same way once on the device. (Does this explanation make sense?) We need to figure out if the tests are failing due to a failure in the software or is the test that needs some modification. For example if we have modified the text in the logs or the order of them it is possible that the test expectations are not met but the software is still fine. |
Oh okey, I understand now. Will look into it 👍 |
@mender-test-bot start pipeline |
Hello 😺 I created a pipeline for you here: Pipeline-1206911451 Build Configuration Matrix
|
515506c
to
9c8b3a8
Compare
Merging these commits will result in the following changelog entries: Changelogs |
@mender-test-bot start pipeline |
Hello 😺 I created a pipeline for you here: Pipeline-1208047869 Build Configuration Matrix
|
ac207fb
to
f7bff76
Compare
4db0a34
to
2e6bd05
Compare
@kacf Problem to fix: Proposed solution (PR): Proposed change in test: With these changes the test_mender_connect_auth_changes() which previously didn’t work now is successful. This test case however from the test_mender_connect_reconnect() test function fails. All the other test cases from the function is successful. The one thing separating the failing test case from the others is that this test case focuses on killing the server and then waiting for the error. |
…on its own, so its not dependent on `mender-update` to do so. Previously `FetchJWTToken()` wasn’t called which wouldn’t let it call the JWT token independently, which made it dependent on `mender-update`. The PR to do this 👉 mendersoftware/mender-connect#134 proposed to fix this issue using `FetchJWTToken()` to fetch the token, to then for `WaitForJwtTokenStateChange()` to retrieve it in it’s waiting. The old mocks for the tests seemed to be more tailored to test the functionality with `GetJWTToken()`. This PR proposes a change in the mocks and test flow to better test the new implementation (where the 'new implementation' is the one proposed in the other PR for ticket MEN-6877) Changelog: None Ticket: MEN-6877 Signed-off-by: Sebastian Opsahl <sebastian.opsahl@northern.tech>
@@ -312,57 +312,49 @@ func (d *MenderShellDaemon) dbusEventLoop(client mender.AuthClient) { | |||
break | |||
} | |||
|
|||
if d.needsReconnect() { |
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.
In this newest commit I removed this extra check "if d.needsReconnect" early in the function which set the needsReconnect value to True. Rather the code now only have one check. Having these two checks doing the same thing must have delayed the tests and made it fail.
|
||
// If the server (Mender client proxy) closed the connection, it is likely that | ||
// both messageLoop is asking for a reconnection and we got JwtTokenStateChange | ||
// signal. So drain here the reconnect channel and reconnect only once | ||
if d.needsReconnect() { | ||
log.Debug("dbusEventLoop: drained reconnect req channel") | ||
log.Trace("dbusEventLoop: daemon needs to reconnect") |
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.
Reference point for message above. Only now one check for setting needsReconnect to True
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.
Okey. But I think now the comment above with regards to "draining" the channel is obsolete, as with the current code this is the only point where the message loop can signal a re-connection.
I think the code is good but we need to adjust the miss-leading comment (or remove?)
…connect This PR is made to change the mocks and testflow in tests to better fit the new implementation of the PR 👉 mendersoftware/mender-connect#134. This PR fixes it so `mender-connect` requests a new JWT token on its own, so its not dependent on `mender-update` to do so. Previously `FetchJWTToken()` wasn’t called which wouldn’t let it call the JWT token independently, which made it dependent on `mender-update`. The proposed fix is using `FetchJWTToken()` to fetch the token, to then for `WaitForJwtTokenStateChange()` to retrieve it in it’s waiting. The old mocks and test flow for the tests seemed to be more tailored to test the functionality with `GetJWTToken()`. This PR proposes a change in the mocks and test flow to better test the new implementation. Changelog: None Ticket: MEN-6877 Signed-off-by: Sebastian Opsahl <sebastian.opsahl@northern.tech>
…connect This PR is made to change the mocks and testflow in tests to better fit the new implementation of the PR 👉 mendersoftware/mender-connect#134. This PR fixes it so `mender-connect` requests a new JWT token on its own, so its not dependent on `mender-update` to do so. Previously `FetchJWTToken()` wasn’t called which wouldn’t let it call the JWT token independently, which made it dependent on `mender-update`. The proposed fix is using `FetchJWTToken()` to fetch the token, to then for `WaitForJwtTokenStateChange()` to retrieve it in it’s waiting. The old mocks and test flow for the tests seemed to be more tailored to test the functionality with `GetJWTToken()`. This PR proposes a change in the mocks and test flow to better test the new implementation. Changelog: None Ticket: MEN-6877 Signed-off-by: Sebastian Opsahl <sebastian.opsahl@northern.tech>
…connect This PR is made to change the mocks and testflow in tests to better fit the new implementation of the PR 👉 mendersoftware/mender-connect#134. This PR fixes it so `mender-connect` requests a new JWT token on its own, so its not dependent on `mender-update` to do so. Previously `FetchJWTToken()` wasn’t called which wouldn’t let it call the JWT token independently, which made it dependent on `mender-update`. The proposed fix is using `FetchJWTToken()` to fetch the token, to then for `WaitForJwtTokenStateChange()` to retrieve it in it’s waiting. The old mocks and test flow for the tests seemed to be more tailored to test the functionality with `GetJWTToken()`. This PR proposes a change in the mocks and test flow to better test the new implementation. Changelog: None Ticket: MEN-6877 Signed-off-by: Sebastian Opsahl <sebastian.opsahl@northern.tech>
d.serverJwt = token | ||
d.serverUrl = serverURL | ||
d.postEvent(e) | ||
log.Tracef("(dbusEventLoop) posting Event: %s", e.event) |
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.
Either we move this entry to before the d.postEvent(e)
line or we change the text for something like "posted Event: ..."
|
||
// If the server (Mender client proxy) closed the connection, it is likely that | ||
// both messageLoop is asking for a reconnection and we got JwtTokenStateChange | ||
// signal. So drain here the reconnect channel and reconnect only once | ||
if d.needsReconnect() { | ||
log.Debug("dbusEventLoop: drained reconnect req channel") | ||
log.Trace("dbusEventLoop: daemon needs to reconnect") |
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.
Okey. But I think now the comment above with regards to "draining" the channel is obsolete, as with the current code this is the only point where the message loop can signal a re-connection.
I think the code is good but we need to adjust the miss-leading comment (or remove?)
620e97f
to
e8ac42f
Compare
Fix to make `mender-connect` request a new JWT token on its own, so its not dependent on `mender-update` to do so. Previously, `mender-connect` relied the Mender client to request new JWT tokens. Since the split of `mender` into `mender-update` and `mender-auth`, it is theoretically possible to run `mender-connect` without `mender-update`, in which case it wouldn't request JWT tokens without this fix. Changelog: None Ticket: MEN-6877 Signed-off-by: Sebastian Opsahl <sebastian.opsahl@northern.tech>
Changelog: Fix to make
mender-connect
request a new JWT token on its own, so its not dependent onmender-update
to do so. Previously,mender-connect
relied the Mender client to request new JWT tokens. Since the split of mender intomender-update
andmender-auth
, it is theoretically possible to run mender-connect without mender-update, in which case it wouldn't request JWT tokens without this fix.Ticket: MEN-6877