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
174 stars 72 forks source link

config: CNF installation (3.1) Limit cnf_setup to only one CNF #2162

Closed svteb closed 1 month ago

svteb commented 1 month ago

Description

Remove the ability of users to run cnf-testsuite cnf_setup {../testsuite.yml} multiple times.

Issues:

Refs: #2095 #2120

How has this been tested:

Types of changes:

Checklist:

Documentation

Code Review

Issue

svteb commented 1 month ago

I have some problems with this one, the main issue is that it would be easiest to implement this change after the rest of the #2120 epic is already done. With #2120 finished we could leverage the ability of setting up multiple CNFs as one, as currently some tests (/spec/5g/ran_spec.cr) rely on setting up two CNFs. There is a hack around this, and that is to use the Helm.install function directly, followed up by KubectlClient::Get.resource_wait_for_install, which is not exactly pretty.

The issue with KubectlClient::Get.resource_wait_for_install is that there are multiple deployments for 5g which could be verified but would make for some ugly code and we would lose out on some of the output that is already in cnf_manager.cr.

This is the code from cnf_manager.cr that verifies a resource is ready, separating it into a different function and reusing it would also take some time and be somewhat unnecessary since cnf_manager.cr is being rewritten somewhere down the #2120 epic line.

        workload_resource_names.each do | resource |
          stdout_success "Waiting for resource (#{current_resource_number}/#{total_resource_count}): [#{resource[:kind]}] #{resource[:name]}", same_line: true
          ready = KubectlClient::Get.resource_wait_for_install(resource[:kind], resource[:name], wait_count: wait_count, namespace: resource[:namespace])
          if !ready
            stdout_failure "CNF setup has timed-out, [#{resource[:kind]}] #{resource[:name]} is not ready after #{wait_count} seconds.", same_line: true
            stdout_failure "Recommended course of actions would be to investigate the resource in cluster, then call cnf_cleanup and try to reinstall the CNF."
            exit 1
          end
          current_resource_number += 1
        end
        stdout_success "All CNF resources are up!", same_line: true

We should rethink how necessary this change is in the current situation. Temporary solutions are available, but we should decide how much more we want to bloat the code if it will be removed eventually.