-
Notifications
You must be signed in to change notification settings - Fork 5
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
Log OCP and CNV versions #29
Conversation
Signed-off-by: Arnon Gilboa <[email protected]>
Signed-off-by: Arnon Gilboa <[email protected]>
673155c
to
e7164d6
Compare
if err != nil { | ||
return err | ||
} | ||
if len(cdis.Items) != 1 { |
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.
maybe check if ==0 then have an error that it doesnt exist and if bigger then one then this current msg?
} | ||
ocpVersion := "" | ||
for _, update := range ver.Status.History { | ||
if update.State == configv1.CompletedUpdate { |
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.
and there is always only on update that has that state? or if not are they sorted by old->new? cause if not you will not get the last version necessarily. Just making sure :)
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.
See doc: The newest update is first in the list and it is ordered by recency.
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.
missed the break
:)
@@ -621,6 +623,37 @@ func (cs *clientStub) GetDataSource(ctx context.Context, namespace, name string) | |||
return das, nil | |||
} | |||
|
|||
func (cs *clientStub) GetClusterVersion(ctx context.Context, name string) (*configv1.ClusterVersion, error) { |
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 about a UT to make sure you get the last updated version? and maybe also negative testing.. although it is pretty straight foreword function..
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.
Will add the positive one :)
Signed-off-by: Arnon Gilboa <[email protected]>
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.
Looks good!
Also go mod tidy && go mod vendor (required for the OpenShift APIs)