Skip to content

Commit

Permalink
feat(e2e): add e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <csatib02@gmail.com>
  • Loading branch information
csatib02 committed Sep 3, 2024
1 parent be81bf8 commit 2aa336e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,8 @@ jobs:
with:
name: Kube-Pod-Autocomplete Helm-Chart

- name: ls
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
pwd
ls -lah
- name: Install Kubectl
run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

- name: Run E2E tests
run: make test-e2e
Expand Down
14 changes: 6 additions & 8 deletions e2e/kpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
pollInterval = 5 * time.Second
pollInterval = 10 * time.Second
healthURL = "http://%s:%d/health"
autocompleteURL = "http://%s:%d/search/autocomplete/%s"
)
Expand All @@ -32,13 +32,6 @@ func TestKPAEndpoints(t *testing.T) {
endpoints := applyResource(features.New("validate endpoint functionality")).
Assess("pods are available", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
// check if test pods are running

time.Sleep(10 * time.Second)

cmd := exec.Command("kubectl", "get", "pods", "-A")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
err := wait.PollUntilContextTimeout(ctx, pollInterval, defaultTimeout, true, func(ctx context.Context) (bool, error) {
// get all pods with label: team=test
pods := &corev1.PodList{}
Expand All @@ -47,6 +40,11 @@ func TestKPAEndpoints(t *testing.T) {
})
require.NoError(t, err)

cmd := exec.Command("kubectl", "get", "pods", "-A")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()

for _, pod := range pods.Items {
if pod.Status.Phase != corev1.PodRunning {
return false, nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"sigs.k8s.io/e2e-framework/third_party/helm"
)

const defaultTimeout = 2 * time.Minute
const defaultTimeout = 3 * time.Minute

var testenv env.Environment

Expand Down

0 comments on commit 2aa336e

Please sign in to comment.