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 tests for Describe tab content in PVC and Pods #1596

Merged
merged 1 commit into from
May 4, 2023

Conversation

cesnietor
Copy link
Contributor

@cesnietor cesnietor commented May 3, 2023

As followup of #1588 this adds some ui tests to make sure we render content when clicking on tabs.

Tests that the following components with IDs exist when clicking on each tab.

Screenshot 2023-05-03 at 3 40 50 PM

Screenshot 2023-05-03 at 3 40 03 PM

Changes:

  • add div with id to all tabs contents modules
  • added tests for pods and pvcs

Test Steps

Tests run as a Job which runs on a kubernetes environment, to replicate this we need a k8s env.

Prerequirements:

  • Kind environment
  • Tenant initialized (preferably) as myminio
  • testcafe installed (npm i -g testcafe)

Build image from branch like:

make assets
make docker TAG="minio/operator:cesnietor" && kind load docker-image minio/operator:cesnietor   

Load image to your kind environment

kind load docker-image minio/operator:cesnietor

Create operator.yaml:

kubectl kustomize . > operator.yaml

Update console image to use the new one:

yq -i -e '(. | select(.spec.selector.matchLabels.app=="console") .spec.template.spec.containers[0].image) = "minio/operator:cesnietor"' operator.yaml

Apply your changes

kubectl apply -f operator.yaml

Portforward Operator Console to your local env:

kubectl port-forward $(kubectl get pods -n minio-operator -l app=console | grep console | awk '{print $1}') 9090 -n minio-operator

In other terminal get the secrets to login to console:

kubectl describe secrets -n minio-operator console-sa-secret | grep 'token:' | awk '{print $2}' | pbcopy
  • Go to your browser http://localhost:9090
  • Login using your JWT
  • Create a tenant called myminio [required since test has tenant hardcoded in tenant-test-1.ts]
  • Update your utils.ts with your jwt (cause tests needs it)
  • Run tests in your local cli like:
testcafe "chrome:headless" web-app/tests/operator/tenant/test-1 --skip-js-errors -c 3

Expected:

√ operator(master) % testcafe "chrome:headless" web-app/tests/operator/tenant/test-1 --skip-js-errors -c 3

 Running tests in:
 - Chrome 113.0.5672.63 / Ventura 13
 - Chrome 113.0.5672.63 / Ventura 13
 - Chrome 113.0.5672.63 / Ventura 13

 For user with default permissions
 ✓ Create Tenant and List Tenants
 ✓ Test describe section for PODs in new tenant
 ✓ Test describe section for PVCs in new tenant


 3 passed (37s)

@allanrogerr
Copy link
Contributor

allanrogerr commented May 4, 2023

After port forward, I would suggest the following testcafe command, specifying the host and port:
testcafe "chrome:headless" web-app/tests/operator/tenant/test-1 --skip-js-errors -c 3 --hostname 127.0.0.1 --port 9090

@cesnietor cesnietor merged commit 27c254a into minio:master May 4, 2023
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.

4 participants