cnti-testcatalog / testsuite

📞📱☎️📡🌐 Cloud Native Telecom Initiative (CNTI) Test Catalog is a tool to check for and provide feedback on the use of K8s + cloud native best practices in networking applications and platforms
https://wiki.lfnetworking.org/display/LN/Test+Catalog
Apache License 2.0
169 stars 70 forks source link

improvement: check if cluster is up and running #1995

Closed barmull closed 1 week ago

barmull commented 2 months ago

Description

Add condition in ensure_kubeconfig! method to check the cluster's health.

Issues:

Refs: #1968

How has this been tested:

Types of changes:

Checklist:

Documentation

Code Review

Issue

barmull commented 2 months ago

For testing I set KUBECONFIG into existing file, but the file is empty. Resulting that KUBECONFIG is set, but cluster is not running. See in this screenshot:

image

agentpoyo commented 2 months ago

Screenshot_2024-04-20_20-03-42

barmull commented 2 months ago

In this case is not working as expected. Because the change is only in method ensure_kubeconfig! In this PR https://github.com/cnti-testcatalog/testsuite/pull/1964 the method ensure_kubeconfig! is added into task create_namespace. So, if you want to properly tested, you need to have this two PRs together. And then you get the same output as mine above.

agentpoyo commented 2 months ago

In this case is not working as expected. Because the change is only in method ensure_kubeconfig! In this PR #1964 the method ensure_kubeconfig! is added into task create_namespace. So, if you want to properly tested, you need to have this two PRs together. And then you get the same output as mine above.

I checked out your fork and both changes were included when tested.

barmull commented 2 months ago

Screenshot_2024-04-20_20-03-42

In your output is missing message 'KUBECONFIG is already set.' It seems that method ensure_kubeconfig is not executing. The method should be inserted in "create_namespace" task. So even if you set KUBECONFIG to existing config file, it should catch unhealthy cluster and raise an error. So instead of 'Could not create cnf-testsuite namespace on the Kubernetes cluster' you should see 'Exit code: 256. Executing this command 'kubectl get nodes --kubeconfig=/path/to/config/file' raised an error. For further information run command in CLI.' image