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

Refactoring Pact tests and adding parametrized states #391

Merged
merged 2 commits into from
Sep 25, 2023

Conversation

Katka92
Copy link
Contributor

@Katka92 Katka92 commented Sep 20, 2023

What does this PR do?:

Separate Pact tests related files to a separate package. Add parametrized states.

Which issue(s)/story(ies) does this PR fixes:

https://issues.redhat.com/browse/HAC-4879

@Katka92 Katka92 force-pushed the refactor_tests branch 2 times, most recently from 047be28 to 6ebc6c2 Compare September 20, 2023 14:54
@flacatus
Copy link
Contributor

/retest

if len(createdHasComp.Status.Conditions) > 1 {
break
}
time.Sleep(10 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use eventually, bad practice to use sleep in tests

if createdHasApp.Status.Conditions[0].Type == "Created" {
break
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use eventually, bad practice to use sleep in tests

break
}
}
time.Sleep(10 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use eventually, bad practice to use sleep in tests

if len(createdHasComp2.Status.Conditions) > 1 {
break
}
time.Sleep(10 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use eventually, bad practice to use sleep in tests

createdHasComp2 := &appstudiov1alpha1.Component{}
for i := 0; i < 12; i++ {
gomega.Expect(k8sClient.Get(context.Background(), hasCompLookupKey2, createdHasComp2)).Should(gomega.Succeed())
if len(createdHasComp2.Status.Conditions) > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

if conditions are not created this will result in panic

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad. I saw something wron

if len(createdHasApp.Status.Conditions) > 0 && strings.Contains(createdHasApp.Status.Devfile, ghCompName) {
break
}
time.Sleep(10 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use eventually, bad practice to use sleep in tests

}, timeout, interval).Should(gomega.BeTrue())

gomega.Eventually(func() bool {
k8sClient.Get(context.Background(), hasAppLookupKey, createdHasApp)

Check warning

Code scanning / Golang security checks by gosec

Errors unhandled. Warning

Errors unhandled.
hasCompLookupKey := types.NamespacedName{Name: comp.name, Namespace: comp.app.namespace}
createdHasComp := &appstudiov1alpha1.Component{}
gomega.Eventually(func() bool {
k8sClient.Get(context.Background(), hasCompLookupKey, createdHasComp)

Check warning

Code scanning / Golang security checks by gosec

Errors unhandled. Warning

Errors unhandled.
createdHasApp := &appstudiov1alpha1.Application{}

gomega.Eventually(func() bool {
k8sClient.Get(context.Background(), hasAppLookupKey, createdHasApp)

Check warning

Code scanning / Golang security checks by gosec

Errors unhandled. Warning

Errors unhandled.
@flacatus
Copy link
Contributor

/hold

hasAppLookupKey := types.NamespacedName{Name: appName, Namespace: HASAppNamespace}
createdHasApp := &appstudiov1alpha1.Application{}
gomega.Eventually(func() bool {
k8sClient.Get(context.Background(), hasAppLookupKey, createdHasApp)

Check warning

Code scanning / Golang security checks by gosec

Errors unhandled. Warning

Errors unhandled.
@flacatus
Copy link
Contributor

/unhold

@flacatus
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm label Sep 21, 2023
@openshift-ci
Copy link

openshift-ci bot commented Sep 21, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: flacatus, Katka92
Once this PR has been reviewed and has the lgtm label, please assign maysunfaisal for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Katka92
Copy link
Contributor Author

Katka92 commented Sep 22, 2023

/assign @maysunfaisal

@thepetk thepetk merged commit c2f7c29 into redhat-appstudio:main Sep 25, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants