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

Add E2E test framework and 2 simple tests #290

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

barney-s
Copy link
Member

@barney-s barney-s commented Feb 11, 2025

Changes

  1. Add e2e test framework
  2. Add 2 tests in e2e/suites/basic using the e2e test framework
  • TestSimpleDeploymentRGD (3 steps)
  • TestAutoscaledDeploymentRGD (4 steps)
  1. E2E tests are executed in a kind cluster as part of PR pulls req using a new github workflows
  2. The image is build and deployed to a kind cluster before testing.
  3. Add 1 test in e2e/suites/advanced to reproduce I have Kubernetes Secrets correctly created, but seing with delta by kro #272. Not invoking the advance tests in workflow

example of successful run: https://github.com/kro-run/kro/actions/runs/13269233780/job/37044442598?pr=290

Test output

❯ make test-e2e
go test -v ./test/e2e/...
?       github.com/kro-run/kro/test/e2e/framework       [no test files]
=== RUN   TestSimpleDeploymentRGD
    basic_test.go:80: Using namespace: e2e-simple-deployment-rgd-1739256596, from: testdata/../../../../test/e2e/testdata/simple-deployment-rgd
    testcase.go:193: Running step0: Install RGD and verify that the RGD is created
    testcase.go:359:    Applying ResourceGraphDefinition/simple-deployment-rgd[rgd.yaml]
    verify.go:57:       Verifying ResourceGraphDefinition/simple-deployment-rgd[0rgd.yaml]
    verify.go:57:       Verifying CustomResourceDefinition/simpledeployments.kro.run[1instancecrd.yaml]
    testcase.go:193: Running step1: Create instance SimpleDeployment with replicas=2
    testcase.go:359:    Applying SimpleDeployment/test-instance[instance.yaml]
    verify.go:57:       Verifying Deployment/test-instance[deployment.yaml]
    testcase.go:193: Running step2: Update instance SimpleDeployment with replicas=3
    testcase.go:359:    Applying SimpleDeployment/test-instance[instance.yaml]
    verify.go:57:       Verifying Deployment/test-instance[deployment.yaml]
    testcase.go:134: Deleting namespace: e2e-simple-deployment-rgd-1739256596
    testcase.go:148: Deleting cluster-scoped object: ResourceGraphDefinition/simple-deployment-rgd
--- PASS: TestSimpleDeploymentRGD (35.18s)
=== RUN   TestAutoscaledDeploymentRGD
    multi_resource_test.go:38: Using namespace: e2e-autoscaled-deployment-rgd-1739256631, from: testdata/../../../../test/e2e/testdata/autoscaled-deployment-rgd
    testcase.go:193: Running step0: Install the RGD AutoscaledDeployment that creates a ConfigMap, Service, Deployment, and HPA 
    testcase.go:359:    Applying ResourceGraphDefinition/autoscaled-deployment-rgd[rgd.yaml]
    verify.go:57:       Verifying ResourceGraphDefinition/autoscaled-deployment-rgd[0rgd.yaml]
    verify.go:57:       Verifying CustomResourceDefinition/autoscaleddeployments.kro.run[1instancecrd.yaml]
    testcase.go:193: Running step1: Create an instance of AutoscaledDeployment with initial settings (version 1.24, 1 replica, 20% CPU utilization) 
    testcase.go:359:    Applying AutoscaledDeployment/test-app-instance[instance.yaml]
    verify.go:57:       Verifying Deployment/test-app-deployment[deployment.yaml]
    verify.go:57:       Verifying HorizontalPodAutoscaler/test-app-hpa[hpa.yaml]
    verify.go:57:       Verifying AutoscaledDeployment/test-app-instance[instance.yaml]
    verify.go:57:       Verifying Service/test-app-service[service.yaml]
    testcase.go:193: Running step2: Update the instance to use a newer version (1.25) which should trigger a rolling update of the Deployment 
    testcase.go:359:    Applying AutoscaledDeployment/test-app-instance[instance.yaml]
    verify.go:57:       Verifying Deployment/test-app-deployment[deployment.yaml]
    testcase.go:193: Running step3: Update the instance to increase replicas to 3 and adjust HPA settings (min: 2, max: 5) 
    testcase.go:359:    Applying AutoscaledDeployment/test-app-instance[instance.yaml]
    verify.go:57:       Verifying Deployment/test-app-deployment[deployment.yaml]
    verify.go:57:       Verifying HorizontalPodAutoscaler/test-app-hpa[hpa.yaml]
    testcase.go:134: Deleting namespace: e2e-autoscaled-deployment-rgd-1739256631
    testcase.go:148: Deleting cluster-scoped object: ResourceGraphDefinition/autoscaled-deployment-rgd
--- PASS: TestAutoscaledDeploymentRGD (55.24s)
PASS
ok      github.com/kro-run/kro/test/e2e/suites/basic    90.480s

@barney-s
Copy link
Member Author

Please look at https://github.com/kubernetes-sigs/e2e-framework and see if we can use it.

…is is expected to fail due to: kro-run#272. So not invoking it as part of GH workflow
- test step for testing kro-run#293. skip it for now till that PR is merged
- test for verifying kro-run#299 - Using
  secrets with stringData
- test for verifying kro-run#300 - using
  secret.metadata.resourceVersion in deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant