-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: Fix flakey test #202
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
29f85de
fix: if Pipeline is paused in order to update its spec, make sure it'…
juliev0 87dc0be
logging
juliev0 a358ec7
fix: empty commit
juliev0 eef5fc1
log
juliev0 8a1ec3e
merge main
juliev0 9479e08
add debug info to e2e
juliev0 26a85bd
fix: empty commit
juliev0 fd30def
fix: empty commit
juliev0 27d1f28
move the printing of Reason to where it will actually happen
juliev0 6c58dea
fix: empty commit
juliev0 3d5ee61
fix: empty commit
juliev0 5ce88d1
fix: empty commit
juliev0 4fcecad
fix: empty commit
juliev0 614476c
fix: empty commit
juliev0 4f8bef0
fix: empty commit
juliev0 d82c313
divide the e2e test into multiple files
juliev0 a0a592a
print Conditions for Pending Pod instead of Reason which isn't showin…
juliev0 1aa8a0f
fix: empty commit
juliev0 edfd0cd
fix: empty commit
juliev0 269fd23
fix: empty commit
juliev0 fb53995
print init container log
juliev0 cdb1d6a
print init container log
juliev0 bb49013
fix: empty commit
juliev0 6fe61a8
fix: empty commit
juliev0 75862fe
fix: empty commit
juliev0 25e166a
fix: empty commit
juliev0 8ce80be
fix: empty commit
juliev0 ee1fca6
fix: empty commit
juliev0 d3257da
try rearranging the order of testing
juliev0 69bd861
fix: empty commit
juliev0 f4e16cd
fix: empty commit
juliev0 92e2323
fix: empty commit
juliev0 7bf3f81
fix: empty commit
juliev0 56fdefb
fix: empty commit
juliev0 0fbc374
create a new cluster for 2nd e2e test
juliev0 1d02b2c
fix: empty commit
juliev0 ab0aea3
fix: empty commit
juliev0 d0ba912
fix: empty commit
juliev0 fb312d5
fix: empty commit
juliev0 17889ed
Merge remote-tracking branch 'origin/main' into test-e2e-pending
juliev0 8c4c065
fix: empty commit
juliev0 417aceb
don't assume 'Namespace' value
juliev0 637cadd
fix: empty commit
juliev0 53498e0
fix: empty commit
juliev0 c2b163a
add namespace parameter
juliev0 1de0df2
remove temporary debugging
juliev0 527cf85
fix lint by commenting function out
juliev0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"sigs.k8s.io/controller-runtime/pkg/envtest" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"k8s.io/client-go/dynamic" | ||
clientgo "k8s.io/client-go/kubernetes" | ||
|
||
"github.com/numaproj/numaplane/internal/util" | ||
"github.com/numaproj/numaplane/internal/util/kubernetes" | ||
planepkg "github.com/numaproj/numaplane/pkg/client/clientset/versioned/typed/numaplane/v1alpha1" | ||
) | ||
|
||
var ( | ||
dynamicClient dynamic.DynamicClient | ||
testEnv *envtest.Environment | ||
ctx context.Context | ||
cancel context.CancelFunc | ||
suiteTimeout = 5 * time.Minute | ||
testTimeout = 2 * time.Minute | ||
|
||
pipelineRolloutClient planepkg.PipelineRolloutInterface | ||
isbServiceRolloutClient planepkg.ISBServiceRolloutInterface | ||
numaflowControllerRolloutClient planepkg.NumaflowControllerRolloutInterface | ||
kubeClient clientgo.Interface | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these variables need to be in a file not including "_test.go" in the name in order to be referenced from the other files |
||
|
||
const ( | ||
Namespace = "numaplane-system" | ||
) | ||
|
||
// document for Ginkgo framework and print to console | ||
func document(testName string) { | ||
snapshotCluster(testName) | ||
By(testName) | ||
} | ||
|
||
func snapshotCluster(testName string) { | ||
fmt.Printf("*** %+v: NAMESPACE POD STATE BEFORE TEST: %s\n", time.Now(), testName) | ||
podList, _ := kubeClient.CoreV1().Pods(Namespace).List(ctx, metav1.ListOptions{}) | ||
if podList != nil { | ||
for _, pod := range podList.Items { | ||
fmt.Printf("Pod: %q, %q\n", pod.Name, pod.Status.Phase) | ||
} | ||
} | ||
} | ||
|
||
func verifyPodsRunning(namespace string, numPods int, labelSelector string) { | ||
document(fmt.Sprintf("verifying %d Pods running with label selector %q", numPods, labelSelector)) | ||
|
||
Eventually(func() bool { | ||
podsList, _ := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) | ||
if podsList != nil && len(podsList.Items) >= numPods { | ||
for _, pod := range podsList.Items { | ||
if pod.Status.Phase != "Running" { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
return false | ||
|
||
}).WithTimeout(testTimeout).Should(BeTrue()) | ||
|
||
} | ||
|
||
func getNumaflowResourceStatus(u *unstructured.Unstructured) (kubernetes.GenericStatus, error) { | ||
statusMap := u.Object["status"] | ||
var status kubernetes.GenericStatus | ||
err := util.StructToStruct(&statusMap, &status) | ||
return status, err | ||
} | ||
|
||
// commenting out to please Lint, but leaving here because it could be useful later | ||
/* | ||
func printPodLogs(client clientgo.Interface, namespace, podName, containerName string) { | ||
podLogOptions := &apiv1.PodLogOptions{Container: containerName} | ||
stream, err := client.CoreV1().Pods(namespace).GetLogs(podName, podLogOptions).Stream(ctx) | ||
if err != nil { | ||
fmt.Printf("Error getting Pod logs: namespace=%q, pod=%q, container=%q\n", namespace, podName, containerName) | ||
return | ||
} | ||
defer stream.Close() | ||
logBytes, _ := io.ReadAll(stream) | ||
fmt.Printf("Printing Log for namespace=%q, pod=%q, container=%q:\n%s\n", namespace, podName, containerName, string(logBytes)) | ||
}*/ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this resolves the CI flakey test by creating a clean cluster before the second e2e test runs