-
Notifications
You must be signed in to change notification settings - Fork 13
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
PTEUDO-1602: DBRoleClaim Tests Update #374
Conversation
Expect(err).NotTo(HaveOccurred()) | ||
|
||
By("Creating the custom resource for the Kind DbRoleClaim in the new namespace") | ||
dbroleclaimdiffnamespace := &persistancev1.DbRoleClaim{} |
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.
Let's use camelCase for vars in Go.
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.
updated
By("Getting the DbRoleClaim resource created in the new namespace") | ||
dbroleclaimdiffnamespace := &persistancev1.DbRoleClaim{} | ||
err = k8sClient.Get(ctx, types.NamespacedName{Name: resourceName, Namespace: newNamespace}, dbroleclaimdiffnamespace) | ||
fmt.Printf("Status of DbRoleClaim: %+v", dbroleclaimdiffnamespace.Status) |
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.
Instead of printing the value, you can check if the status is what we expect.
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.
updated
err = k8sClient.Get(ctx, secretName, secret) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
fmt.Printf("Secret Name: %s, Secret Data: %s", secret.Name, secret.Data) |
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 here.
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.
updated
if err == nil { | ||
fmt.Println("Connection to the database successful") | ||
} |
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 think we don't need to print this, you are already checking whether there is an error or not.
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.
updated
if tableDescription.Valid { | ||
description = tableDescription.String | ||
} | ||
fmt.Printf("Table: %s, Owner: %s, Size: %s, Description: %s", tableName, tableOwner, tableSize, description) |
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 think it is more secure to check instead of printing the values.
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.
updated
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.
Approved ✔️ .
You can create a follow-up task to extend the test and include one for testing the creation/relation between the schemas and roles.
Added the following new DbRoleClaim Tests , creating a roleclaim in new namespace for a Dbclaim existing in another namespace
Output of running test