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

Log OCP and CNV versions #29

Merged
merged 3 commits into from
Jan 7, 2024
Merged

Conversation

arnongilboa
Copy link
Collaborator

@arnongilboa arnongilboa commented Jan 4, 2024

Also go mod tidy && go mod vendor (required for the OpenShift APIs)

if err != nil {
return err
}
if len(cdis.Items) != 1 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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 :)

Copy link
Collaborator Author

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.

Copy link
Collaborator

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) {
Copy link
Collaborator

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..

Copy link
Collaborator Author

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 :)

Copy link
Collaborator

@ShellyKa13 ShellyKa13 left a comment

Choose a reason for hiding this comment

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

Looks good!

@arnongilboa arnongilboa merged commit 45ca3f9 into kiagnose:main Jan 7, 2024
4 checks passed
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