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

DEVOPS-28230 remove version validation #306

Merged
merged 15 commits into from
Sep 30, 2024

Conversation

EvertonCalgarotto
Copy link
Contributor

@EvertonCalgarotto EvertonCalgarotto commented Sep 24, 2024

If NEW Claim and DBVersion="" version 15 is used instead
If EXISTING Claim and DBVersion= "" then version from Status.ActiveDB is used

@EvertonCalgarotto EvertonCalgarotto marked this pull request as draft September 24, 2024 20:40
@EvertonCalgarotto EvertonCalgarotto marked this pull request as ready for review September 24, 2024 20:48
Copy link
Contributor

@drewwells drewwells left a comment

Choose a reason for hiding this comment

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

Some unsafe use of slices that will panic. Otherwise looks good

By("Reconciling the created resource")

_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{NamespacedName: typeNamespacedName})
Expect(err).To(MatchError(".spec.dbVersion is a mandatory field and cannot be empty"))
Expect(err).NotTo(HaveOccurred())
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better to still have some sort of error here. I believe the idea of this set of tests is to verify dbclaims update and can be fixed by changing their values. What can we do to continue to simulate that error MajorVersion 12? Invalid database type?

pkg/databaseclaim/awsprovider.go Outdated Show resolved Hide resolved
pkg/databaseclaim/awsprovider.go Outdated Show resolved Hide resolved
pkg/databaseclaim/databaseclaim.go Show resolved Hide resolved
return false
}
return activeVersion != p.EngineVersion
return strings.Split(activeVersion, ".")[0] != strings.Split(p.DBVersion, ".")[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

unsafe use of indexing a slice. Maybe make a type, there's a lot of comparisons going around here

type Version struct {
  Major, Minor string
}
v := Version{Major:"15", "Minor: "3"}
return cmp.Equal(v.Major, "15")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this works if the string is "", "15" or "15.2"
looks ugly, but works

@EvertonCalgarotto EvertonCalgarotto merged commit 8124ea5 into main Sep 30, 2024
3 checks passed
@EvertonCalgarotto EvertonCalgarotto deleted the DEVOPS-28230-remove-version-validation branch September 30, 2024 15:49
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