Skip to content
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(windows-agent): Don't spam contract server #375

Merged
merged 7 commits into from
Nov 16, 2023

Conversation

EduardGomezEscandell
Copy link
Contributor

@EduardGomezEscandell EduardGomezEscandell commented Oct 30, 2023

We shouldn't need to talk to the contracts server back-end if the registry already contains a pro token fetched from them. Rather, we should wait until our subscription expires, then get a new token (or more likely: the same token with an extended expiration date, this is up to the CS team).


UDENG-1667

Copy link
Collaborator

@didrocks didrocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have a few comments and questions, but nothing major!

windows-agent/internal/contracts/contracts.go Outdated Show resolved Hide resolved
windows-agent/internal/contracts/contracts.go Outdated Show resolved Hide resolved
windows-agent/internal/contracts/contracts_test.go Outdated Show resolved Hide resolved
We don't need to querry the contract server if whe have a non-expired,
store-backed Ubuntu Pro token.
This is necessary to test the function with mocked back-ends for
the contract server and Microsoft Store.
These tests were written before we had any mocks for the MS store or the
Contract server. The previous commits significantly change the
implementation of the FetchMicrosoftStoreSubscription function, so it is
now a great time to flesh out its tests with the new mocks.
@EduardGomezEscandell
Copy link
Contributor Author

Rebased main, changes start now:

Copy link
Collaborator

@didrocks didrocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! :)

@EduardGomezEscandell EduardGomezEscandell merged commit f8675f2 into main Nov 16, 2023
28 checks passed
@EduardGomezEscandell EduardGomezEscandell deleted the dont-spam-contract-server branch November 16, 2023 14:21
EduardGomezEscandell added a commit that referenced this pull request Nov 20, 2023
Seems like -1<<64 is not a valid timestamp. Let's just throw instead of
returning a dummy number. The Go wrapper already catches the
ErrNotSubscribed exception.

Let's wait for #375 since the new behaviour is easier to reason about.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants