-
Notifications
You must be signed in to change notification settings - Fork 233
feat: expectation pattern support #2941
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
base: next
Are you sure you want to change the base?
Conversation
90bebc4 to
ac807a7
Compare
6b9d9a3 to
4da5d2b
Compare
ca4c8a2 to
c3c33bc
Compare
838d1a3 to
4c1de74
Compare
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
cfde8f5 to
603ac9d
Compare
| import io.fabric8.kubernetes.api.model.HasMetadata; | ||
|
|
||
| record RegisteredExpectation<P extends HasMetadata>( | ||
| LocalDateTime registeredAt, Duration timeout, Expectation<P> expectation) { |
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.
registeredAt should probably not be left over to the caller, we can set it in the constructor
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 sure how do you mean it, you mean the user should provide the regsiteredAt?
|
|
||
| assertThat(result.isExpectationPresent()).isTrue(); | ||
| assertThat(result.isTimedOut()).isTrue(); | ||
| assertThat(expectationManager.isExpectationPresent(configMap)).isTrue(); |
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.
TBH I find this a little strange. Maybe timedout expectation should be handled differently. Because is it present after it timeouts?
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 idea is that we preserv that state, since user for sure want to handle that situation when the expectation is timed out, so we dont't remove timed out expectation. This is what you mean?
| expectationManager.setExpectation(configMap, Duration.ofMinutes(5), expectation); | ||
| Optional<String> name = expectationManager.getExpectationName(configMap); | ||
|
|
||
| assertThat(name).contains(expectedName); |
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.
equals?
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.
it's an optional, so I guess this is right.
| expectationManager.setExpectation(configMap, Duration.ofMinutes(5), expectation); | ||
| assertThat(expectationManager.isExpectationPresent(configMap)).isTrue(); | ||
|
|
||
| expectationManager.cleanup(configMap); |
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 prefer removeExpectation
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.
yeah, sounds a bit better, thx, changed!
| return UpdateControl.noUpdate(); | ||
| } | ||
| } else { | ||
| // checks the expectation if it is fulfilled also removes it, |
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 fix as in the docs
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 sure what do you mean... pls ellaborate
Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
|
thank you @xstefank for all the fixes in javadocs and other suggestions!! |
See related issue