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
initial commit for tests #50
Conversation
Hi @lina-nikiforova. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
32da4ce
to
4d5045e
Compare
14a27f7
to
a9fcf55
Compare
9035b30
to
7e79f42
Compare
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.
@lina-nikiforova it looks very good so far, thank you a lot! I just added some nitpicks, we might discuss about them f2f
test/integration/bugs_test.go
Outdated
err := kubeClient.CoreV1().Secrets("openshift-config").Delete("support", &metav1.DeleteOptions{}) | ||
|
||
// if the secret is not found, continue, not a problem | ||
if (err != nil) && (err.Error() != "secrets \"support\" not found") { |
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.
!=
operator has higher precedence that &&
, so strictly speaking parenthesis are not needed there
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.
you can write `secrets "support" not found` instead of escaping quote (but it depends what you prefer)
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.
thanks!
test/integration/bugs_test.go
Outdated
// restart insights-operator (delete pods) | ||
pods, err := kubeClient.CoreV1().Pods("openshift-insights").List(metav1.ListOptions{}) | ||
if err != nil { | ||
panic(err.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.
t.Fatal(err.Error())
test/integration/bugs_test.go
Outdated
|
||
// if the secret is not found, continue, not a problem | ||
if (err != nil) && (err.Error() != "secrets \"support\" not found") { | ||
panic(err.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.
t.Fatal(err.Error())
test/integration/bugs_test.go
Outdated
// check logs for "Gathering cluster info every 2h0m0s" | ||
newPods, err := kubeClient.CoreV1().Pods("openshift-insights").List(metav1.ListOptions{}) | ||
if err != nil { | ||
panic(err.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.
t.Fatal(err.Error())
test/integration/bugs_test.go
Outdated
log := buf.String() | ||
|
||
result := strings.Contains(log, "Gathering cluster info every 2h0m0s") | ||
podLogs.Close() |
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'd suggest to use defer podLogs.Close()
on line 63 or so
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 had it there but somehow got errors when I used it... I'll try to look into it again
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.
now it seems to work, I was missing handling of one of the errors :)
test/integration/main_test.go
Outdated
) | ||
|
||
func KubeClient() (result *kubernetes.Clientset) { | ||
kubeconfig := os.Getenv("KUBECONFIG") // variable is a path to the local kubeconfig |
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.
would be good to test whether the $KUBECONFIG
exists at all
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.
done using os.LookupEnv
_, err := kubeClient.CoreV1().Pods("openshift-insights").Get(pod.Name, metav1.GetOptions{}) | ||
if err == nil { | ||
fmt.Printf("the pod is not yet deleted: %v\n", err) | ||
return false, nil |
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'm not sure there - should not it be rather:
return false, err
?
/ok-to-test |
9824ccd
to
ce14464
Compare
/retest |
@mfojtik, please put a required label if you think this PR is fine. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lina-nikiforova, mfojtik The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Output locally