From 3bd5d2c13b06ba6191126111aaa7a2e95d172d3c Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:43:02 +0300 Subject: [PATCH 01/28] website for our cnf to run need to call ./run-cnf-suites.sh -l lifecycle -s true -s new filed mean if i want to run that from the website --- cnf-certification-test/amalpro/index.html | 247 ++++++++++++++ cnf-certification-test/amalpro/logs.js | 13 + cnf-certification-test/amalpro/submit.js | 48 +++ cnf-certification-test/amalpro/toast.js | 53 +++ cnf-certification-test/index.html | 260 ++++++++++++++ cnf-certification-test/log.log | 395 ++++++++++++++++++++++ cnf-certification-test/suite_test.go | 353 +++++++++++++++++-- 7 files changed, 1340 insertions(+), 29 deletions(-) create mode 100644 cnf-certification-test/amalpro/index.html create mode 100644 cnf-certification-test/amalpro/logs.js create mode 100644 cnf-certification-test/amalpro/submit.js create mode 100644 cnf-certification-test/amalpro/toast.js create mode 100644 cnf-certification-test/index.html create mode 100644 cnf-certification-test/log.log diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/amalpro/index.html new file mode 100644 index 000000000..14b632651 --- /dev/null +++ b/cnf-certification-test/amalpro/index.html @@ -0,0 +1,247 @@ + + + + + + CNF Certification Test + + + + + + + + + + + + +
+ Red Hat +
+ +
+

CNF Certification Test

+ +
+ + +
+ Environment Configuration + + +
+ +
+ TNF Configuration + + + + + + +
+ +
+ Select a Test + + + +
+ + Run Certification Test +
+ Show Log +
+ + +

Logs

+ No Logs Found + Close +
+ + + + + + © 2022 Red Hat, Inc. + + + + + ({ ...acc, + [key]: key in acc ? [acc[key], val] : val + }), {}); + + delete fields.submit; + console.log(fields); + + // Send an HTTP request to the server to run the function + let heading; + let message; + let state = 'success'; + + try { + const data = await fetch('/runFunction', { + method: 'POST', + headers: { 'Content-Type': 'application/json', }, + body: JSON.stringify(fields), + }).then(response => { + if (response.ok) { + return response.json(); + } else { + throw new Error(response.statusText); + } + }); + + heading = 'Success'; + message = data.Message; + + console.log(data); + } catch (error) { + console.error(error); + heading = 'Error' + message = error.message; + state = 'danger'; + } finally { + form.elements.submit.disabled = false; + for (const el of form.elements) if (el instanceof HTMLFieldSetElement) el.disabled = false + } + + return { heading, message, state }; + } \ No newline at end of file diff --git a/cnf-certification-test/amalpro/toast.js b/cnf-certification-test/amalpro/toast.js new file mode 100644 index 000000000..1516826de --- /dev/null +++ b/cnf-certification-test/amalpro/toast.js @@ -0,0 +1,53 @@ +import '@rhds/elements/rh-alert/rh-alert.js'; + +export async function toast({ + heading, + message, + state = 'info', + timeout = 8_000, +}) { + await import('@rhds/elements/rh-alert/rh-alert.js'); + const h2 = document.createElement('h2'); + h2.textContent = heading; + h2.slot = 'header'; + const alert = document.createElement('rh-alert'); + alert.setAttribute('aria-live', 'polite'); + alert.dismissable = true; + alert.state = state; + alert.classList.add('toast'); + alert.style.position = 'fixed'; + alert.style.margin = '0'; + alert.style.setProperty('z-index', '1000'); + alert.style.setProperty('inset-inline-end', 'var(--rh-space-xl, 24px)'); + alert.style.setProperty('inset-block-start', 'var(--rh-space-xl, 24px)'); + alert.append(h2); + if (message) { + const p = document.createElement('p'); + p.textContent = message; + alert.append(message); + } + + alert.animate({ translate: ['100% 0', '0 0'] }, { duration: 200 }); + + await Promise.all(Array.from(document.querySelectorAll('rh-alert.toast'), toast => + // TODO: handle more than 2 toasts + toast.animate({ + translate: [ + '0 auto', + '0 calc(100% + 20px)', + ], + }, { + duration: 200, + composite: 'accumulate', + rangeEnd: '100%', + fill: 'forwards', + }).finished)); + + setTimeout(() => { + if (alert.isConnected) { + alert.remove(); + } + }, timeout); + + document.body.append(alert); +} \ No newline at end of file diff --git a/cnf-certification-test/index.html b/cnf-certification-test/index.html new file mode 100644 index 000000000..f4e096447 --- /dev/null +++ b/cnf-certification-test/index.html @@ -0,0 +1,260 @@ + + + + + + + + + + + Run Function + + + + + + + + + Red Hat logo +

CNF CERTIFICATION TEST WEBPAGE

+
+
+
+ + +

Environment Configuration

+
+ + + + + +

TNF Configuration

+
+ + + + + + + +

Selecet a Test

+
+ +
+
+ + + +
+
+
+
+ +

Click Run Certification Test

+ Run Certification Test +

Show Certification Test log

+ Show Log + + +
+

Log Output

+

+		X
+    
+ + + + + + + © 2022 Red Hat, Inc. + + + \ No newline at end of file diff --git a/cnf-certification-test/log.log b/cnf-certification-test/log.log new file mode 100644 index 000000000..f68b6425e --- /dev/null +++ b/cnf-certification-test/log.log @@ -0,0 +1,395 @@ +INFO [Oct 19 17:05:52.390][suite_test.go: 398] KUBECONFIG : /Users/amal/Downloads/kubeconfig.3nodes +INFO [Oct 19 17:05:52.390][suite_test.go: 400] Labels filter : lifecycle +INFO [Oct 19 17:05:52.390][suite_test.go: 436] /Users/amal/Downloads/kubeconfig.3nodes +INFO [Oct 19 17:05:52.390][utils.go: 66] Saving environment variables & parameters. +INFO [Oct 19 17:05:52.390][utils.go: 71] Environment: {Home:/Users/amal Kubeconfig:/Users/amal/Downloads/kubeconfig.3nodes ConfigurationPath:tnf_config.yml NonIntrusiveOnly:false LogLevel:debug OfflineDB: AllowPreflightInsecure:false PfltDockerconfig: IncludeWebFilesInOutputFolder:false OmitArtifactsZipFile:false EnableDataCollection:false} +INFO [Oct 19 17:05:52.390][suite_test.go: 122] Log level set to: debug +INFO [Oct 19 17:05:52.391][suite_test.go: 452] Ginkgo Version : 2.12.1 +INFO [Oct 19 17:05:52.391][suite_test.go: 453] Labels filter : lifecycle +INFO [Oct 19 17:05:52.391][suite_test.go: 128] &{/Users/amal /Users/amal/Downloads/kubeconfig.3nodes tnf_config.yml false debug false false false false} +INFO [Oct 19 17:05:52.391][clientsholder.go: 169] Creating k8s go-clients holder. +INFO [Oct 19 17:05:53.857][utils.go: 42] Loading config from file: tnf_config.yml +WARNING[Oct 19 17:05:53.858][utils.go: 55] No namespace configured for the debug DaemonSet. Defaulting to namespace cnf-suite +INFO [Oct 19 17:06:05.785][main.go: 436] namespace cnf-suite deleted +INFO [Oct 19 17:06:06.411][main.go: 175] Checking if the daemonset exists +INFO [Oct 19 17:06:06.566][main.go: 178] daemonset tnf-debug does not exist, err=daemonsets.apps "tnf-debug" not found +INFO [Oct 19 17:06:06.566][main.go: 226] Creating daemonset tnf-debug +INFO [Oct 19 17:06:07.344][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:0 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:0 NumberUnavailable:3 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:12.502][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:12.502][main.go: 281] All the debug pods are ready. +INFO [Oct 19 17:06:12.502][main.go: 237] Daemonset is ready +INFO [Oct 19 17:06:12.811][main.go: 243] Successfully created daemonset tnf-debug +INFO [Oct 19 17:06:13.283][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:13.283][main.go: 281] All the debug pods are ready. +INFO [Oct 19 17:06:13.441][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:06:13.441][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:06:13.609][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:06:13.764][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:06:14.253][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:06:14.583][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:06:16.090][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:06:16.243][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:06:16.398][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:06:16.398][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:06:17.018][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:06:17.324][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:06:17.478][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:06:18.760][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:06:18.760][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:06:18.761][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:06:18.914][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:06:18.914][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:19.091][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:19.265][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:06:19.437][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:06:19.437][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:06:19.437][provider.go: 311] Completed the test environment build process in 25.58 seconds +This will be written to the log file. +DEBUG [Oct 19 17:06:36.971][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:06:37.282][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:06:37.282][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:06:37.601][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:06:37.757][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:06:38.398][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:06:38.727][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:06:40.202][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:06:40.396][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:06:40.554][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:06:40.554][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:06:41.179][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:06:41.497][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:06:41.652][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:06:42.947][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:06:42.947][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:06:42.948][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:06:43.101][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:06:43.101][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:43.269][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:43.438][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:06:43.613][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:06:43.614][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:06:43.614][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:06:43.614][provider.go: 311] Completed the test environment build process in 6.64 seconds +DEBUG [Oct 19 17:06:43.614][suite.go: 60] Entering access-control suite +DEBUG [Oct 19 17:06:43.614][suite.go: 46] Entering affiliated-certification suite +DEBUG [Oct 19 17:06:43.614][suite.go: 54] Entering lifecycle suite +DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering manageability suite +DEBUG [Oct 19 17:06:43.615][suite.go: 52] Entering networking suite +DEBUG [Oct 19 17:06:43.615][suite.go: 40] Entering observability suite +DEBUG [Oct 19 17:06:43.615][suite.go: 35] Entering operator suite +DEBUG [Oct 19 17:06:43.615][suite.go: 49] Entering platform-alteration suite +DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering preflight suite +DEBUG [Oct 19 17:06:43.615][suite.go: 43] Skipping the preflight suite because the Docker Config file is not provided. +DEBUG [Oct 19 17:06:43.615][suite.go: 44] Entering performance suite +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-0 ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-1 ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-0 ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-1 ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-0 ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-1 ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-0 ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-1 ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-0 ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-1 ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-0 ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-1 ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf startup probe +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-0 owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-1 owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-2fk6c owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-wmj2m owner reference +INFO [Oct 19 17:06:43.618][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. +INFO [Oct 19 17:06:43.618][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:06:43.773][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:06:43.773][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:06:43.933][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:06:43.933][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:06:43.933][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:06:43.933][podrecreation.go: 51] Performing cordon operation on node clus0-2 +DEBUG [Oct 19 17:06:44.405][suite.go: 570] node: clus0-2 cordoned +DEBUG [Oct 19 17:06:44.406][suite.go: 576] draining node: clus0-2 with timeout: 8m0s +DEBUG [Oct 19 17:06:44.406][podrecreation.go: 113] deleting ns=tnf pod=test-0 with deleteForeground mode +DEBUG [Oct 19 17:06:45.574][podrecreation.go: 159] ns=tnf pod=test-0 deleted +INFO [Oct 19 17:06:45.574][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. +INFO [Oct 19 17:06:45.575][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:06:45.730][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:06:45.730][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +INFO [Oct 19 17:06:45.888][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:06:45.888][podsets.go: 199] Not ready StatefulSets: [tnf:test] +INFO [Oct 19 17:07:00.888][podsets.go: 192] Checking Deployments readiness of Deployments [] +INFO [Oct 19 17:07:00.889][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:01.055][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:01.056][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:01.056][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:01.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 +INFO [Oct 19 17:07:02.642][podrecreation.go: 51] Performing cordon operation on node clus0-0 +DEBUG [Oct 19 17:07:03.963][suite.go: 570] node: clus0-0 cordoned +DEBUG [Oct 19 17:07:03.964][suite.go: 576] draining node: clus0-0 with timeout: 9m0s +DEBUG [Oct 19 17:07:03.964][podrecreation.go: 113] deleting ns=tnf pod=test-1 with deleteForeground mode +DEBUG [Oct 19 17:07:04.299][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-wmj2m with deleteForeground mode +DEBUG [Oct 19 17:07:06.065][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-wmj2m deleted +DEBUG [Oct 19 17:07:06.233][podrecreation.go: 159] ns=tnf pod=test-1 deleted +INFO [Oct 19 17:07:06.233][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. +INFO [Oct 19 17:07:06.233][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +INFO [Oct 19 17:07:06.400][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +INFO [Oct 19 17:07:06.572][podsets.go: 198] Not ready Deployments: [tnf:test] +INFO [Oct 19 17:07:06.572][podsets.go: 199] Not ready StatefulSets: [tnf:test] +INFO [Oct 19 17:07:21.573][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:07:21.738][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:07:21.738][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:21.907][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:21.907][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:21.907][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:21.907][podrecreation.go: 51] Performing uncordon operation on node clus0-0 +INFO [Oct 19 17:07:22.734][podrecreation.go: 51] Performing cordon operation on node clus0-1 +DEBUG [Oct 19 17:07:24.042][suite.go: 570] node: clus0-1 cordoned +DEBUG [Oct 19 17:07:24.054][suite.go: 576] draining node: clus0-1 with timeout: 8m0s +DEBUG [Oct 19 17:07:24.054][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-2fk6c with deleteForeground mode +DEBUG [Oct 19 17:07:26.465][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-2fk6c deleted +INFO [Oct 19 17:07:26.465][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. +INFO [Oct 19 17:07:26.465][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +INFO [Oct 19 17:07:26.631][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:26.797][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:26.797][podsets.go: 198] Not ready Deployments: [tnf:test] +INFO [Oct 19 17:07:26.797][podsets.go: 199] Not ready StatefulSets: [] +INFO [Oct 19 17:07:41.798][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:07:41.957][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:07:41.957][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [] +INFO [Oct 19 17:07:41.957][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:41.957][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:41.957][podrecreation.go: 51] Performing uncordon operation on node clus0-1 +INFO [Oct 19 17:07:43.096][podrecreation.go: 51] Performing uncordon operation on node clus0-1 +INFO [Oct 19 17:07:43.579][podrecreation.go: 51] Performing uncordon operation on node clus0-0 +INFO [Oct 19 17:07:44.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 +DEBUG [Oct 19 17:07:44.692][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:07:45.020][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:07:45.020][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:07:45.193][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:07:45.355][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:07:46.004][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:07:46.340][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:07:47.722][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:07:47.881][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:07:48.038][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:07:48.055][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:07:48.678][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:07:48.997][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:07:49.152][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:07:50.462][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:07:50.630][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:07:50.630][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:07:50.810][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:07:51.020][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:07:51.390][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:07:51.391][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:07:51.391][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:07:51.391][provider.go: 311] Completed the test environment build process in 6.70 seconds +INFO [Oct 19 17:07:53.160][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:54.315][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:55.476][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:56.632][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:57.841][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:59.000][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:00.160][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:01.317][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:02.473][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:03.631][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:04.789][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:05.945][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:07.100][podsets.go: 44] deployment: test ns: tnf is not ready yet +DEBUG [Oct 19 17:08:08.254][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:08:08.561][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:08:08.561][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:08:08.725][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:08:08.881][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:08:09.199][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:08:09.526][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:08:09.880][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:08:11.375][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:08:11.531][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:08:11.687][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:08:11.687][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:08:12.314][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:08:12.622][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:08:12.776][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:08:14.078][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:08:14.236][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:08:14.236][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:14.408][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:14.580][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:08:14.784][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:08:14.784][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:08:14.784][provider.go: 311] Completed the test environment build process in 6.53 seconds +DEBUG [Oct 19 17:08:16.369][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:08:16.678][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:08:16.678][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:08:16.844][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:08:17.001][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:08:17.485][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:08:17.810][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:08:19.152][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:08:19.305][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:08:19.458][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:08:19.458][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:08:20.082][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:08:20.391][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:08:20.547][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:08:21.850][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:08:22.004][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:08:22.004][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:22.179][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:22.351][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:08:22.531][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:08:22.531][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:08:22.531][provider.go: 311] Completed the test environment build process in 6.16 seconds +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-0 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-1 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-rtxbr ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-vvlwx ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +INFO [Oct 19 17:08:22.636][archiver.go: 45] Compressing results artifacts into /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/20231019-170822-cnf-test-results.tar.gz +DEBUG [Oct 19 17:08:22.637][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claim.json +DEBUG [Oct 19 17:08:22.666][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/cnf-certification-tests_junit.xml +DEBUG [Oct 19 17:08:22.667][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claimjson.js +DEBUG [Oct 19 17:08:22.700][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/results.html diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 22a900793..782e94368 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,14 +17,20 @@ package suite import ( + "bufio" _ "embed" + "encoding/json" "flag" + "fmt" + "net/http" "os" "path/filepath" "testing" "time" + "github.com/gorilla/websocket" "github.com/onsi/ginkgo/v2" + "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" "github.com/test-network-function/cnf-certification-test/cnf-certification-test/results" "github.com/test-network-function/cnf-certification-test/pkg/claimhelper" @@ -56,8 +62,10 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" + serverRun = "runserver" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" + defaultServerRun = false ) var ( @@ -77,13 +85,28 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string + serveRun *bool ) +//go:embed amalpro/index.html +var indexHTML []byte + +//go:embed amalpro/submit.js +var submit []byte + +//go:embed amalpro/logs.js +var logs []byte + +//go:embed amalpro/toast.js +var toast []byte + func init() { claimPath = flag.String(claimPathFlagKey, defaultClaimPath, "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") + serveRun = flag.Bool(serverRun, defaultServerRun, + "the path for the junit format report") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -102,6 +125,7 @@ func setLogLevel() { func getK8sClientsConfigFileNames() []string { params := configuration.GetTestParameters() + logrus.Info(params) fileNames := []string{} if params.Kubeconfig != "" { fileNames = append(fileNames, params.Kubeconfig) @@ -126,6 +150,59 @@ func getGitVersion() string { return gitDisplayRelease + " ( " + GitCommit + " )" } +func startServer() { + log.Info("inside starting the server") + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "text/html". + w.Header().Set("Content-Type", "text/html") + // Write the embedded HTML content to the response. + _, err := w.Write(indexHTML) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(submit) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(logs) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(toast) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/runFunction", runHandler) + // Serve the static HTML file + http.HandleFunc("/logstream", logStreamHandler) + + fmt.Println("Server is running on :8080...") + if err := http.ListenAndServe(":8080", nil); err != nil { + panic(err) + } +} + // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { // When running unit tests, skip the suite @@ -147,43 +224,55 @@ func TestTest(t *testing.T) { log.Infof("Claim Format Version: %s", ClaimFormatVersion) log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) + log.Infof("*serveRun : %v", *serveRun) + log.Info("starting the server") + + go startServer() + // Keep the main program running // Diagnostic functions will run when no labels are provided. - var diagnosticMode bool - if ginkgoConfig.LabelFilter == "" { - log.Infof("TNF will run in diagnostic mode so no test case will be launched.") - diagnosticMode = true - } + if !*serveRun { + var diagnosticMode bool + if ginkgoConfig.LabelFilter == "" { + log.Infof("TNF will run in diagnostic mode so no test case will be launched.") + diagnosticMode = true + } - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) + // Initialize the claim with the start time, tnf version, etc. + claimRoot := claimhelper.CreateClaimRoot() + claimData := claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - // initialize abort flag - testhelper.AbortTrigger = "" + // initialize abort flag + testhelper.AbortTrigger = "" - // Run tests specs only if not in diagnostic mode, otherwise all TSs would run. - var env provider.TestEnvironment - if !diagnosticMode { - env.SetNeedsRefresh() - env = provider.GetTestEnvironment() - ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) + // Run tests specs only if not in diagnostic mode, otherwise all TSs would run. + var env provider.TestEnvironment + if !diagnosticMode { + env.SetNeedsRefresh() + env = provider.GetTestEnvironment() + ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) + } + continueRun(t, diagnosticMode, env, claimData, claimRoot) } + select {} +} + +func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -211,7 +300,7 @@ func TestTest(t *testing.T) { // Send claim file to the collector if specified by env var if configuration.GetTestParameters().EnableDataCollection { - err = collector.SendClaimFileToCollector(env.CollectorAppEndPoint, claimOutputFile, env.ExecutedBy, env.PartnerName, env.CollectorAppPassword) + err := collector.SendClaimFileToCollector(env.CollectorAppEndPoint, claimOutputFile, env.ExecutedBy, env.PartnerName, env.CollectorAppPassword) if err != nil { log.Errorf("Failed to send post request to the collector: %v", err) } @@ -264,3 +353,209 @@ func incorporateVersions(claimData *claim.Claim) { ClaimFormat: ClaimFormatVersion, } } + +var upgrader = websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +// Define an HTTP handler that triggers Ginkgo tests +func runHandler(w http.ResponseWriter, r *http.Request) { + // Run Ginkgo tests + var requestData RequestData + //var responseData ResponseData + // Parse JSON data from the request body + err := json.NewDecoder(r.Body).Decode(&requestData) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + // Create or open a log file + filename := "log.log" + if _, err := os.Stat(filename); err == nil { + // If it exists, truncate it to remove the contents + file, err := os.OpenFile(filename, os.O_TRUNC, 0) + if err != nil { + // Handle the error if necessary + panic(err) + } + file.Close() + } + logFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) + if err != nil { + panic(err) + } + logrus.SetOutput(logFile) + originalStdout := os.Stdout + os.Stdout = logFile + // Read the YAML file + defer func() { + os.Stdout = originalStdout + logFile.Close() + }() + os.Setenv("KUBECONFIG", requestData.KubeConfigPath) + logrus.Infof("KUBECONFIG : %v", requestData.KubeConfigPath) + + logrus.Infof("Labels filter : %v", requestData.SelectedOptions) + + // Set the output of the logger to the log file + + /*data, err := os.ReadFile("tnf_config.yml") + if err != nil { + log.Fatalf("Error reading YAML file: %v", err) + } + + // Unmarshal the YAML data into a Config struct + var config configuration.TestConfiguration + + err = yaml.Unmarshal(data, &config) + if err != nil { + log.Fatalf("Error unmarshaling YAML: %v", err) + } + + // Modify the configuration + var namespace []configuration.Namespace + namespace = append(namespace, configuration.Namespace{Name: requestData.Field3}) + + config.TargetNameSpaces = namespace // Change the port to a new value + + // Serialize the modified config back to YAML format + newData, err := yaml.Marshal(&config) + if err != nil { + log.Fatalf("Error marshaling YAML: %v", err) + } + + // Write the modified YAML data back to the file + err = os.WriteFile("tnf_config.yml", newData, os.ModePerm) + if err != nil { + log.Fatalf("Error writing YAML file: %v", err) + } + */ + t := testing.T{} + logrus.Infof(os.Getenv("KUBECONFIG")) + // When running unit tests, skip the suite + if os.Getenv("UNIT_TEST") != "" { + t.Skip("Skipping test suite when running unit tests") + } + + err = configuration.LoadEnvironmentVariables() + if err != nil { + log.Fatalf("could not load the environment variables, error: %v", err) + } + + // Set up logging params for logrus + loghelper.SetLogFormat() + setLogLevel() + + ginkgoConfig, _ := ginkgo.GinkgoConfiguration() + log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) + log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) + + // Initialize the claim with the start time, tnf version, etc. + claimRoot := claimhelper.CreateClaimRoot() + claimData := claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) + + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + + // initialize abort flag + testhelper.AbortTrigger = "" + + fmt.Println("This will be written to the log file.") + var env provider.TestEnvironment + env.SetNeedsRefresh() + env = provider.GetTestEnvironment() + // fetch the current config + suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration() + // adjust it + suiteConfig.SkipStrings = []string{"NEVER-RUN"} + reporterConfig.FullTrace = true + reporterConfig.JUnitReport = "cnf-certification-tests_junit.xml" + // pass it in to RunSpecs + suiteConfig.LabelFilter = requestData.SelectedOptions + ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) + + continueRun(&t, false, env, claimData, claimRoot) + // Return the result as JSON + response := struct { + Message string `json:"Message"` + }{ + Message: fmt.Sprintf("Sucsses to run %s", requestData.SelectedOptions), + } + // Serialize the response data to JSON + jsonResponse, err := json.Marshal(response) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + // Set the Content-Type header to specify that the response is JSON + w.Header().Set("Content-Type", "application/json") + + // Write the JSON response to the client + _, err = w.Write(jsonResponse) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + +} + +func logStreamHandler(w http.ResponseWriter, r *http.Request) { + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + log.Printf("WebSocket upgrade error: %v", err) + return + } + defer conn.Close() + + filePath := "log.log" + + // Open the log file + file, err := os.Open(filePath) + if err != nil { + log.Println(err) + return + } + defer file.Close() + + // Create a scanner to read the log file line by line + for { + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + "\n" + // Send each log line to the client + if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + fmt.Println(err) + //return + } + + // Sleep for a short duration to simulate real-time updates + time.Sleep(100 * time.Millisecond) + } + if err := scanner.Err(); err != nil { + log.Printf("Error reading log file: %v", err) + } + + time.Sleep(1 * time.Second) + } + +} + +type RequestData struct { + KubeConfigPath string `json:"kubeConfigPath"` + SelectedOptions string `json:"selectedOptions"` +} +type ResponseData struct { + Message string `json:"message"` +} From 2bfd874aa10e523f2a671df9783e374d631d60d7 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:27:58 +0300 Subject: [PATCH 02/28] a few changes(add upload file) and added the -s for server --- cnf-certification-test/amalpro/index.html | 18 +- cnf-certification-test/amalpro/logs.js | 2 - cnf-certification-test/amalpro/submit.js | 6 +- cnf-certification-test/log.log | 395 ---------------------- cnf-certification-test/suite_test.go | 83 ++++- go.mod | 1 + go.sum | 1 + run-cnf-suites.sh | 17 +- 8 files changed, 94 insertions(+), 429 deletions(-) delete mode 100644 cnf-certification-test/log.log diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/amalpro/index.html index 14b632651..dbac2fdbb 100644 --- a/cnf-certification-test/amalpro/index.html +++ b/cnf-certification-test/amalpro/index.html @@ -137,16 +137,12 @@ const { toast } = await import('./toast.js'); await toast({ heading, message, state, timeout: 20_000 }); }); - document.getElementById('show-logs').addEventListener('click', function(event) { - const socket = new WebSocket('ws://localhost:8080/logstream'); + document.getElementById('show-logs').addEventListener('click', async function(event) { const code = document - .getElementById('logs') - .querySelector('rh-code-block'); + .getElementById('logs') + .querySelector('rh-code-block'); code.textContent = ''; - // Handle incoming log messages - socket.addEventListener('message', function (event) { - code.textContent += event.data + '\n'; - }); + await import('./logs.js') }); @@ -168,11 +164,9 @@

CNF Certification Test

Environment Configuration - + type="file">
diff --git a/cnf-certification-test/amalpro/logs.js b/cnf-certification-test/amalpro/logs.js index 4f2da81dd..a3624f210 100644 --- a/cnf-certification-test/amalpro/logs.js +++ b/cnf-certification-test/amalpro/logs.js @@ -4,10 +4,8 @@ const socket = new WebSocket('ws://localhost:8080/logstream'); const code = document .getElementById('logs') .querySelector('rh-code-block'); - console.log(code) code.textContent = ''; // Handle incoming log messages socket.addEventListener('message', function (event) { code.textContent += event.data + '\n'; - console.log(code.textContent) }); \ No newline at end of file diff --git a/cnf-certification-test/amalpro/submit.js b/cnf-certification-test/amalpro/submit.js index af6eeb14f..e06d0aab9 100644 --- a/cnf-certification-test/amalpro/submit.js +++ b/cnf-certification-test/amalpro/submit.js @@ -11,7 +11,8 @@ export async function submit(form) { delete fields.submit; console.log(fields); - + formdata.append("jsonData", JSON.stringify(fields)); + // Send an HTTP request to the server to run the function let heading; let message; @@ -20,8 +21,7 @@ export async function submit(form) { try { const data = await fetch('/runFunction', { method: 'POST', - headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(fields), + body: formdata, }).then(response => { if (response.ok) { return response.json(); diff --git a/cnf-certification-test/log.log b/cnf-certification-test/log.log deleted file mode 100644 index f68b6425e..000000000 --- a/cnf-certification-test/log.log +++ /dev/null @@ -1,395 +0,0 @@ -INFO [Oct 19 17:05:52.390][suite_test.go: 398] KUBECONFIG : /Users/amal/Downloads/kubeconfig.3nodes -INFO [Oct 19 17:05:52.390][suite_test.go: 400] Labels filter : lifecycle -INFO [Oct 19 17:05:52.390][suite_test.go: 436] /Users/amal/Downloads/kubeconfig.3nodes -INFO [Oct 19 17:05:52.390][utils.go: 66] Saving environment variables & parameters. -INFO [Oct 19 17:05:52.390][utils.go: 71] Environment: {Home:/Users/amal Kubeconfig:/Users/amal/Downloads/kubeconfig.3nodes ConfigurationPath:tnf_config.yml NonIntrusiveOnly:false LogLevel:debug OfflineDB: AllowPreflightInsecure:false PfltDockerconfig: IncludeWebFilesInOutputFolder:false OmitArtifactsZipFile:false EnableDataCollection:false} -INFO [Oct 19 17:05:52.390][suite_test.go: 122] Log level set to: debug -INFO [Oct 19 17:05:52.391][suite_test.go: 452] Ginkgo Version : 2.12.1 -INFO [Oct 19 17:05:52.391][suite_test.go: 453] Labels filter : lifecycle -INFO [Oct 19 17:05:52.391][suite_test.go: 128] &{/Users/amal /Users/amal/Downloads/kubeconfig.3nodes tnf_config.yml false debug false false false false} -INFO [Oct 19 17:05:52.391][clientsholder.go: 169] Creating k8s go-clients holder. -INFO [Oct 19 17:05:53.857][utils.go: 42] Loading config from file: tnf_config.yml -WARNING[Oct 19 17:05:53.858][utils.go: 55] No namespace configured for the debug DaemonSet. Defaulting to namespace cnf-suite -INFO [Oct 19 17:06:05.785][main.go: 436] namespace cnf-suite deleted -INFO [Oct 19 17:06:06.411][main.go: 175] Checking if the daemonset exists -INFO [Oct 19 17:06:06.566][main.go: 178] daemonset tnf-debug does not exist, err=daemonsets.apps "tnf-debug" not found -INFO [Oct 19 17:06:06.566][main.go: 226] Creating daemonset tnf-debug -INFO [Oct 19 17:06:07.344][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:0 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:0 NumberUnavailable:3 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:12.502][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:12.502][main.go: 281] All the debug pods are ready. -INFO [Oct 19 17:06:12.502][main.go: 237] Daemonset is ready -INFO [Oct 19 17:06:12.811][main.go: 243] Successfully created daemonset tnf-debug -INFO [Oct 19 17:06:13.283][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:13.283][main.go: 281] All the debug pods are ready. -INFO [Oct 19 17:06:13.441][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:06:13.441][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:06:13.609][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:06:13.764][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:06:14.253][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:06:14.583][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:06:16.090][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:06:16.243][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:06:16.398][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:06:16.398][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:06:17.018][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:06:17.324][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:06:17.478][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:06:18.760][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:06:18.760][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:06:18.761][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:06:18.914][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:06:18.914][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:19.091][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:19.265][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:06:19.437][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:06:19.437][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:06:19.437][provider.go: 311] Completed the test environment build process in 25.58 seconds -This will be written to the log file. -DEBUG [Oct 19 17:06:36.971][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:06:37.282][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:06:37.282][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:06:37.601][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:06:37.757][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:06:38.398][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:06:38.727][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:06:40.202][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:06:40.396][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:06:40.554][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:06:40.554][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:06:41.179][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:06:41.497][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:06:41.652][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:06:42.947][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:06:42.947][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:06:42.948][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:06:43.101][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:06:43.101][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:43.269][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:43.438][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:06:43.613][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:06:43.614][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:06:43.614][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:06:43.614][provider.go: 311] Completed the test environment build process in 6.64 seconds -DEBUG [Oct 19 17:06:43.614][suite.go: 60] Entering access-control suite -DEBUG [Oct 19 17:06:43.614][suite.go: 46] Entering affiliated-certification suite -DEBUG [Oct 19 17:06:43.614][suite.go: 54] Entering lifecycle suite -DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering manageability suite -DEBUG [Oct 19 17:06:43.615][suite.go: 52] Entering networking suite -DEBUG [Oct 19 17:06:43.615][suite.go: 40] Entering observability suite -DEBUG [Oct 19 17:06:43.615][suite.go: 35] Entering operator suite -DEBUG [Oct 19 17:06:43.615][suite.go: 49] Entering platform-alteration suite -DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering preflight suite -DEBUG [Oct 19 17:06:43.615][suite.go: 43] Skipping the preflight suite because the Docker Config file is not provided. -DEBUG [Oct 19 17:06:43.615][suite.go: 44] Entering performance suite -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-0 ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-1 ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-0 ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-1 ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-0 ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-1 ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-0 ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-1 ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-0 ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-1 ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-0 ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-1 ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf startup probe -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-0 owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-1 owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-2fk6c owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-wmj2m owner reference -INFO [Oct 19 17:06:43.618][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. -INFO [Oct 19 17:06:43.618][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:06:43.773][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:06:43.773][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:06:43.933][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:06:43.933][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:06:43.933][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:06:43.933][podrecreation.go: 51] Performing cordon operation on node clus0-2 -DEBUG [Oct 19 17:06:44.405][suite.go: 570] node: clus0-2 cordoned -DEBUG [Oct 19 17:06:44.406][suite.go: 576] draining node: clus0-2 with timeout: 8m0s -DEBUG [Oct 19 17:06:44.406][podrecreation.go: 113] deleting ns=tnf pod=test-0 with deleteForeground mode -DEBUG [Oct 19 17:06:45.574][podrecreation.go: 159] ns=tnf pod=test-0 deleted -INFO [Oct 19 17:06:45.574][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. -INFO [Oct 19 17:06:45.575][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:06:45.730][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:06:45.730][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -INFO [Oct 19 17:06:45.888][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:06:45.888][podsets.go: 199] Not ready StatefulSets: [tnf:test] -INFO [Oct 19 17:07:00.888][podsets.go: 192] Checking Deployments readiness of Deployments [] -INFO [Oct 19 17:07:00.889][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:01.055][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:01.056][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:01.056][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:01.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 -INFO [Oct 19 17:07:02.642][podrecreation.go: 51] Performing cordon operation on node clus0-0 -DEBUG [Oct 19 17:07:03.963][suite.go: 570] node: clus0-0 cordoned -DEBUG [Oct 19 17:07:03.964][suite.go: 576] draining node: clus0-0 with timeout: 9m0s -DEBUG [Oct 19 17:07:03.964][podrecreation.go: 113] deleting ns=tnf pod=test-1 with deleteForeground mode -DEBUG [Oct 19 17:07:04.299][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-wmj2m with deleteForeground mode -DEBUG [Oct 19 17:07:06.065][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-wmj2m deleted -DEBUG [Oct 19 17:07:06.233][podrecreation.go: 159] ns=tnf pod=test-1 deleted -INFO [Oct 19 17:07:06.233][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. -INFO [Oct 19 17:07:06.233][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -INFO [Oct 19 17:07:06.400][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -INFO [Oct 19 17:07:06.572][podsets.go: 198] Not ready Deployments: [tnf:test] -INFO [Oct 19 17:07:06.572][podsets.go: 199] Not ready StatefulSets: [tnf:test] -INFO [Oct 19 17:07:21.573][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:07:21.738][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:07:21.738][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:21.907][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:21.907][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:21.907][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:21.907][podrecreation.go: 51] Performing uncordon operation on node clus0-0 -INFO [Oct 19 17:07:22.734][podrecreation.go: 51] Performing cordon operation on node clus0-1 -DEBUG [Oct 19 17:07:24.042][suite.go: 570] node: clus0-1 cordoned -DEBUG [Oct 19 17:07:24.054][suite.go: 576] draining node: clus0-1 with timeout: 8m0s -DEBUG [Oct 19 17:07:24.054][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-2fk6c with deleteForeground mode -DEBUG [Oct 19 17:07:26.465][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-2fk6c deleted -INFO [Oct 19 17:07:26.465][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. -INFO [Oct 19 17:07:26.465][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -INFO [Oct 19 17:07:26.631][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:26.797][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:26.797][podsets.go: 198] Not ready Deployments: [tnf:test] -INFO [Oct 19 17:07:26.797][podsets.go: 199] Not ready StatefulSets: [] -INFO [Oct 19 17:07:41.798][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:07:41.957][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:07:41.957][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [] -INFO [Oct 19 17:07:41.957][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:41.957][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:41.957][podrecreation.go: 51] Performing uncordon operation on node clus0-1 -INFO [Oct 19 17:07:43.096][podrecreation.go: 51] Performing uncordon operation on node clus0-1 -INFO [Oct 19 17:07:43.579][podrecreation.go: 51] Performing uncordon operation on node clus0-0 -INFO [Oct 19 17:07:44.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 -DEBUG [Oct 19 17:07:44.692][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:07:45.020][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:07:45.020][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:07:45.193][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:07:45.355][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:07:46.004][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:07:46.340][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:07:47.722][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:07:47.881][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:07:48.038][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:07:48.055][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:07:48.678][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:07:48.997][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:07:49.152][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:07:50.462][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:07:50.630][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:07:50.630][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:07:50.810][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:07:51.020][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:07:51.390][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:07:51.391][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:07:51.391][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:07:51.391][provider.go: 311] Completed the test environment build process in 6.70 seconds -INFO [Oct 19 17:07:53.160][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:54.315][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:55.476][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:56.632][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:57.841][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:59.000][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:00.160][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:01.317][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:02.473][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:03.631][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:04.789][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:05.945][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:07.100][podsets.go: 44] deployment: test ns: tnf is not ready yet -DEBUG [Oct 19 17:08:08.254][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:08:08.561][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:08:08.561][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:08:08.725][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:08:08.881][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:08:09.199][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:08:09.526][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:08:09.880][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:08:11.375][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:08:11.531][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:08:11.687][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:08:11.687][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:08:12.314][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:08:12.622][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:08:12.776][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:08:14.078][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:08:14.236][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:08:14.236][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:14.408][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:14.580][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:08:14.784][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:08:14.784][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:08:14.784][provider.go: 311] Completed the test environment build process in 6.53 seconds -DEBUG [Oct 19 17:08:16.369][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:08:16.678][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:08:16.678][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:08:16.844][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:08:17.001][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:08:17.485][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:08:17.810][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:08:19.152][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:08:19.305][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:08:19.458][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:08:19.458][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:08:20.082][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:08:20.391][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:08:20.547][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:08:21.850][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:08:22.004][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:08:22.004][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:22.179][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:22.351][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:08:22.531][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:08:22.531][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:08:22.531][provider.go: 311] Completed the test environment build process in 6.16 seconds -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-0 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-1 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-rtxbr ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-vvlwx ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -INFO [Oct 19 17:08:22.636][archiver.go: 45] Compressing results artifacts into /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/20231019-170822-cnf-test-results.tar.gz -DEBUG [Oct 19 17:08:22.637][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claim.json -DEBUG [Oct 19 17:08:22.666][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/cnf-certification-tests_junit.xml -DEBUG [Oct 19 17:08:22.667][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claimjson.js -DEBUG [Oct 19 17:08:22.700][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/results.html diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 782e94368..c47d90fa3 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -22,9 +22,11 @@ import ( "encoding/json" "flag" "fmt" + "io" "net/http" "os" "path/filepath" + "strings" "testing" "time" @@ -363,14 +365,9 @@ var upgrader = websocket.Upgrader{ // Define an HTTP handler that triggers Ginkgo tests func runHandler(w http.ResponseWriter, r *http.Request) { // Run Ginkgo tests - var requestData RequestData //var responseData ResponseData // Parse JSON data from the request body - err := json.NewDecoder(r.Body).Decode(&requestData) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } + // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -394,10 +391,50 @@ func runHandler(w http.ResponseWriter, r *http.Request) { os.Stdout = originalStdout logFile.Close() }() - os.Setenv("KUBECONFIG", requestData.KubeConfigPath) - logrus.Infof("KUBECONFIG : %v", requestData.KubeConfigPath) + logrus.Info(r.FormValue("selectedOptions")) + + jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field + logrus.Info(jsonData) + var data RequstedData + if err := json.Unmarshal([]byte(jsonData), &data); err != nil { + fmt.Println("Error:", err) + } + logrus.Info("Field1:", data.SelectedOptions) + var flattenedOptions []string + flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) + logrus.Info("Field1:", flattenedOptions) + + // Get the file from the request + file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field + if err != nil { + http.Error(w, "Unable to retrieve file from form", http.StatusBadRequest) + return + } + defer file.Close() + + // Create a new file on the server to store the uploaded content + uploadedFile, err := os.Create(handler.Filename) + if err != nil { + http.Error(w, "Unable to create file for writing", http.StatusInternalServerError) + return + } + defer uploadedFile.Close() + + // Copy the uploaded file's content to the new file + _, err = io.Copy(uploadedFile, file) + if err != nil { + http.Error(w, "Unable to copy file", http.StatusInternalServerError) + return + } + + logrus.Infof("Labels filter : %v", flattenedOptions) + + // Copy the uploaded file to the server file - logrus.Infof("Labels filter : %v", requestData.SelectedOptions) + os.Setenv("KUBECONFIG", handler.Filename) + logrus.Infof("KUBECONFIG : %v", handler.Filename) + + logrus.Infof("Labels filter : %v", flattenedOptions) // Set the output of the logger to the log file @@ -483,7 +520,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { reporterConfig.FullTrace = true reporterConfig.JUnitReport = "cnf-certification-tests_junit.xml" // pass it in to RunSpecs - suiteConfig.LabelFilter = requestData.SelectedOptions + suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) continueRun(&t, false, env, claimData, claimRoot) @@ -491,7 +528,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { response := struct { Message string `json:"Message"` }{ - Message: fmt.Sprintf("Sucsses to run %s", requestData.SelectedOptions), + Message: fmt.Sprintf("Sucsses to run %s", strings.Join(flattenedOptions, "")), } // Serialize the response data to JSON jsonResponse, err := json.Marshal(response) @@ -552,10 +589,28 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { } -type RequestData struct { - KubeConfigPath string `json:"kubeConfigPath"` - SelectedOptions string `json:"selectedOptions"` +type RequstedData struct { + SelectedOptions interface{} `json:"selectedOptions"` } type ResponseData struct { Message string `json:"message"` } + +func flattenData(data interface{}, result []string) []string { + switch v := data.(type) { + case string: + result = append(result, v) + case []interface{}: + for _, item := range v { + result = flattenData(item, result) + } + case map[string]interface{}: + for key, item := range v { + if key == "selectedOptions" { + result = flattenData(item, result) + } + result = flattenData(item, result) + } + } + return result +} diff --git a/go.mod b/go.mod index 98831e19f..7cfc0394f 100644 --- a/go.mod +++ b/go.mod @@ -213,6 +213,7 @@ require ( github.com/fatih/color v1.15.0 github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 + github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e diff --git a/go.sum b/go.sum index c4ca47ec4..71b916246 100644 --- a/go.sum +++ b/go.sum @@ -327,6 +327,7 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 7e7a0465d..d1c700d11 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -8,16 +8,17 @@ set -x export OUTPUT_LOC="$PWD/cnf-certification-test" usage() { - echo "$0 [-o OUTPUT_LOC] [-l LABEL...]" + echo "$0 [-o OUTPUT_LOC] [-l LABEL...] [-s run from webpage]" echo "Call the script and list the test suites to run" echo " e.g." echo " $0 [ARGS] -l \"access-control,lifecycle\"" echo " will run the access-control and lifecycle suites" echo " $0 [ARGS] -l all will run all the tests" + echo " $0 [ARGS] -s true will run the test from server" echo "" echo "Allowed suites are listed in the README." echo "" - echo "The specs can be listed with $0 -L|--list [-l LABEL...]" + echo "The specs can be listed with $0 -L|--list [-l LABEL...] [-s run from webpage]" } usage_error() { @@ -42,13 +43,22 @@ while [[ $1 == -* ]]; do ;; -o) if (($# > 1)); then - OUTPUT_LOC=$2 + SERVER_RUN=$2 shift else echo >&2 '-o requires an argument' exit 1 fi ;; + -s) + if (($# > 1)); then + SERVER_RUN=$2 + shift + else + echo >&2 '-s requires an argument' + exit 1 + fi + ;; -l | --label) while (("$#" >= 2)) && ! [[ $2 = --* ]] && ! [[ $2 = -* ]]; do LABEL="$LABEL $2" @@ -86,6 +96,7 @@ GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ +-runserver $SERVER_RUN\ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ From 1f166cd5ad247f501ffc27f854d4d48e623bcb94 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:59:11 +0300 Subject: [PATCH 03/28] change folder name --- cnf-certification-test/suite_test.go | 14 +++++++------- .../{amalpro => webserver}/index.html | 0 .../{amalpro => webserver}/logs.js | 0 .../{amalpro => webserver}/submit.js | 0 .../{amalpro => webserver}/toast.js | 0 5 files changed, 7 insertions(+), 7 deletions(-) rename cnf-certification-test/{amalpro => webserver}/index.html (100%) rename cnf-certification-test/{amalpro => webserver}/logs.js (100%) rename cnf-certification-test/{amalpro => webserver}/submit.js (100%) rename cnf-certification-test/{amalpro => webserver}/toast.js (100%) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index c47d90fa3..6fcc1ca57 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -90,16 +90,16 @@ var ( serveRun *bool ) -//go:embed amalpro/index.html +//go:embed webserver/index.html var indexHTML []byte -//go:embed amalpro/submit.js +//go:embed webserver/submit.js var submit []byte -//go:embed amalpro/logs.js +//go:embed webserver/logs.js var logs []byte -//go:embed amalpro/toast.js +//go:embed webserver/toast.js var toast []byte func init() { @@ -127,7 +127,6 @@ func setLogLevel() { func getK8sClientsConfigFileNames() []string { params := configuration.GetTestParameters() - logrus.Info(params) fileNames := []string{} if params.Kubeconfig != "" { fileNames = append(fileNames, params.Kubeconfig) @@ -229,7 +228,6 @@ func TestTest(t *testing.T) { log.Infof("*serveRun : %v", *serveRun) log.Info("starting the server") - go startServer() // Keep the main program running // Diagnostic functions will run when no labels are provided. @@ -270,8 +268,10 @@ func TestTest(t *testing.T) { ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } continueRun(t, diagnosticMode, env, claimData, claimRoot) + } else { + go startServer() + select {} } - select {} } func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/webserver/index.html similarity index 100% rename from cnf-certification-test/amalpro/index.html rename to cnf-certification-test/webserver/index.html diff --git a/cnf-certification-test/amalpro/logs.js b/cnf-certification-test/webserver/logs.js similarity index 100% rename from cnf-certification-test/amalpro/logs.js rename to cnf-certification-test/webserver/logs.js diff --git a/cnf-certification-test/amalpro/submit.js b/cnf-certification-test/webserver/submit.js similarity index 100% rename from cnf-certification-test/amalpro/submit.js rename to cnf-certification-test/webserver/submit.js diff --git a/cnf-certification-test/amalpro/toast.js b/cnf-certification-test/webserver/toast.js similarity index 100% rename from cnf-certification-test/amalpro/toast.js rename to cnf-certification-test/webserver/toast.js From b628a537c355ef0b642c19ca229042c62091a26a Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:00:01 +0300 Subject: [PATCH 04/28] Delete index.html --- cnf-certification-test/index.html | 260 ------------------------------ 1 file changed, 260 deletions(-) delete mode 100644 cnf-certification-test/index.html diff --git a/cnf-certification-test/index.html b/cnf-certification-test/index.html deleted file mode 100644 index f4e096447..000000000 --- a/cnf-certification-test/index.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - Run Function - - - - - - - - - Red Hat logo -

CNF CERTIFICATION TEST WEBPAGE

-
-
-
- - -

Environment Configuration

-
- - - - - -

TNF Configuration

-
- - - - - - - -

Selecet a Test

-
- -
-
- - - -
-
-
-
- -

Click Run Certification Test

- Run Certification Test -

Show Certification Test log

- Show Log - - -
-

Log Output

-

-		X
-    
- - - - - - - © 2022 Red Hat, Inc. - - - \ No newline at end of file From bd8cba1a962f306d1667712cfb0d39ade35d1163 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:31:42 +0300 Subject: [PATCH 05/28] added new function and rename names --- cnf-certification-test/suite_test.go | 117 +++++++++------------------ run-cnf-suites.sh | 5 +- 2 files changed, 39 insertions(+), 83 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 6fcc1ca57..911a19b8e 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -64,10 +64,10 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" - serverRun = "runserver" + serverModeFlag = "server-mode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" - defaultServerRun = false + defaultServerMode = "false" ) var ( @@ -87,7 +87,7 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string - serveRun *bool + serverMode *string ) //go:embed webserver/index.html @@ -107,8 +107,8 @@ func init() { "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") - serveRun = flag.Bool(serverRun, defaultServerRun, - "the path for the junit format report") + serverMode = flag.String(serverModeFlag, defaultServerMode, + "run test with webserver") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -203,9 +203,7 @@ func startServer() { panic(err) } } - -// TestTest invokes the CNF Certification Test Suite. -func TestTest(t *testing.T) { +func preRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // When running unit tests, skip the suite if os.Getenv("UNIT_TEST") != "" { t.Skip("Skipping test suite when running unit tests") @@ -225,38 +223,43 @@ func TestTest(t *testing.T) { log.Infof("Claim Format Version: %s", ClaimFormatVersion) log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) - log.Infof("*serveRun : %v", *serveRun) - log.Info("starting the server") + log.Infof("run test with webserver : %v", *serverMode) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - // Keep the main program running + // Initialize the claim with the start time, tnf version, etc. + claimRoot = claimhelper.CreateClaimRoot() + claimData = claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) - // Diagnostic functions will run when no labels are provided. - if !*serveRun { + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } + + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + return claimData, claimRoot +} + +// TestTest invokes the CNF Certification Test Suite. +func TestTest(t *testing.T) { + + // Keep the main program running + ginkgoConfig, _ := ginkgo.GinkgoConfiguration() + if *serverMode == "false" { + claimData, claimRoot := preRun(t) var diagnosticMode bool + // Diagnostic functions will run when no labels are provided. + if ginkgoConfig.LabelFilter == "" { log.Infof("TNF will run in diagnostic mode so no test case will be launched.") diagnosticMode = true } - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) - - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } - - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - // initialize abort flag testhelper.AbortTrigger = "" @@ -364,10 +367,6 @@ var upgrader = websocket.Upgrader{ // Define an HTTP handler that triggers Ginkgo tests func runHandler(w http.ResponseWriter, r *http.Request) { - // Run Ginkgo tests - //var responseData ResponseData - // Parse JSON data from the request body - // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -391,7 +390,6 @@ func runHandler(w http.ResponseWriter, r *http.Request) { os.Stdout = originalStdout logFile.Close() }() - logrus.Info(r.FormValue("selectedOptions")) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) @@ -399,10 +397,8 @@ func runHandler(w http.ResponseWriter, r *http.Request) { if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } - logrus.Info("Field1:", data.SelectedOptions) var flattenedOptions []string flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) - logrus.Info("Field1:", flattenedOptions) // Get the file from the request file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field @@ -427,8 +423,6 @@ func runHandler(w http.ResponseWriter, r *http.Request) { return } - logrus.Infof("Labels filter : %v", flattenedOptions) - // Copy the uploaded file to the server file os.Setenv("KUBECONFIG", handler.Filename) @@ -470,46 +464,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } */ t := testing.T{} - logrus.Infof(os.Getenv("KUBECONFIG")) - // When running unit tests, skip the suite - if os.Getenv("UNIT_TEST") != "" { - t.Skip("Skipping test suite when running unit tests") - } - - err = configuration.LoadEnvironmentVariables() - if err != nil { - log.Fatalf("could not load the environment variables, error: %v", err) - } - - // Set up logging params for logrus - loghelper.SetLogFormat() - setLogLevel() - - ginkgoConfig, _ := ginkgo.GinkgoConfiguration() - log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) - log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) - - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - - // initialize abort flag - testhelper.AbortTrigger = "" - - fmt.Println("This will be written to the log file.") + claimData, claimRoot := preRun(&t) var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index d1c700d11..7be443e4b 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -29,6 +29,7 @@ usage_error() { TIMEOUT=24h0m0s LABEL='' LIST=false +SERVER_RUN=false BASEDIR=$(dirname "$(realpath "$0")") # Parse args beginning with "-". @@ -43,7 +44,7 @@ while [[ $1 == -* ]]; do ;; -o) if (($# > 1)); then - SERVER_RUN=$2 + OUTPUT_LOC=$2 shift else echo >&2 '-o requires an argument' @@ -96,7 +97,7 @@ GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --runserver $SERVER_RUN\ +-server-mode $SERVER_RUN \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ From f82548be7151332c16ba65c68753849382a17995 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:52:24 +0300 Subject: [PATCH 06/28] add new file for html function --- cnf-certification-test/suite_test.go | 162 ++----------------- cnf-certification-test/webserver_function.go | 145 +++++++++++++++++ 2 files changed, 162 insertions(+), 145 deletions(-) create mode 100644 cnf-certification-test/webserver_function.go diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 911a19b8e..bbf9bed63 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,7 +17,6 @@ package suite import ( - "bufio" _ "embed" "encoding/json" "flag" @@ -30,7 +29,6 @@ import ( "testing" "time" - "github.com/gorilla/websocket" "github.com/onsi/ginkgo/v2" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" @@ -90,18 +88,6 @@ var ( serverMode *string ) -//go:embed webserver/index.html -var indexHTML []byte - -//go:embed webserver/submit.js -var submit []byte - -//go:embed webserver/logs.js -var logs []byte - -//go:embed webserver/toast.js -var toast []byte - func init() { claimPath = flag.String(claimPathFlagKey, defaultClaimPath, "the path where the claimfile will be output") @@ -151,59 +137,7 @@ func getGitVersion() string { return gitDisplayRelease + " ( " + GitCommit + " )" } -func startServer() { - log.Info("inside starting the server") - - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "text/html". - w.Header().Set("Content-Type", "text/html") - // Write the embedded HTML content to the response. - _, err := w.Write(indexHTML) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(submit) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(logs) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(toast) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/runFunction", runHandler) - // Serve the static HTML file - http.HandleFunc("/logstream", logStreamHandler) - - fmt.Println("Server is running on :8080...") - if err := http.ListenAndServe(":8080", nil); err != nil { - panic(err) - } -} -func preRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { +func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // When running unit tests, skip the suite if os.Getenv("UNIT_TEST") != "" { t.Skip("Skipping test suite when running unit tests") @@ -251,7 +185,7 @@ func TestTest(t *testing.T) { // Keep the main program running ginkgoConfig, _ := ginkgo.GinkgoConfiguration() if *serverMode == "false" { - claimData, claimRoot := preRun(t) + claimData, claimRoot := PreRun(t) var diagnosticMode bool // Diagnostic functions will run when no labels are provided. @@ -270,14 +204,14 @@ func TestTest(t *testing.T) { env = provider.GetTestEnvironment() ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } - continueRun(t, diagnosticMode, env, claimData, claimRoot) + ContinueRun(t, diagnosticMode, env, claimData, claimRoot) } else { - go startServer() + go StartServer() select {} } } -func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { +func ContinueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -358,15 +292,20 @@ func incorporateVersions(claimData *claim.Claim) { ClaimFormat: ClaimFormatVersion, } } +func StartServer() { + + HandlereqFunc() -var upgrader = websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { - return true - }, + http.HandleFunc("/runFunction", RunHandler) + + fmt.Println("Server is running on :8080...") + if err := http.ListenAndServe(":8080", nil); err != nil { + panic(err) + } } // Define an HTTP handler that triggers Ginkgo tests -func runHandler(w http.ResponseWriter, r *http.Request) { +func RunHandler(w http.ResponseWriter, r *http.Request) { // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -464,7 +403,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } */ t := testing.T{} - claimData, claimRoot := preRun(&t) + claimData, claimRoot := PreRun(&t) var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() @@ -478,7 +417,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) - continueRun(&t, false, env, claimData, claimRoot) + ContinueRun(&t, false, env, claimData, claimRoot) // Return the result as JSON response := struct { Message string `json:"Message"` @@ -502,70 +441,3 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } } - -func logStreamHandler(w http.ResponseWriter, r *http.Request) { - conn, err := upgrader.Upgrade(w, r, nil) - if err != nil { - log.Printf("WebSocket upgrade error: %v", err) - return - } - defer conn.Close() - - filePath := "log.log" - - // Open the log file - file, err := os.Open(filePath) - if err != nil { - log.Println(err) - return - } - defer file.Close() - - // Create a scanner to read the log file line by line - for { - scanner := bufio.NewScanner(file) - for scanner.Scan() { - line := scanner.Text() + "\n" - // Send each log line to the client - if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { - fmt.Println(err) - //return - } - - // Sleep for a short duration to simulate real-time updates - time.Sleep(100 * time.Millisecond) - } - if err := scanner.Err(); err != nil { - log.Printf("Error reading log file: %v", err) - } - - time.Sleep(1 * time.Second) - } - -} - -type RequstedData struct { - SelectedOptions interface{} `json:"selectedOptions"` -} -type ResponseData struct { - Message string `json:"message"` -} - -func flattenData(data interface{}, result []string) []string { - switch v := data.(type) { - case string: - result = append(result, v) - case []interface{}: - for _, item := range v { - result = flattenData(item, result) - } - case map[string]interface{}: - for key, item := range v { - if key == "selectedOptions" { - result = flattenData(item, result) - } - result = flattenData(item, result) - } - } - return result -} diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go new file mode 100644 index 000000000..30bb3e787 --- /dev/null +++ b/cnf-certification-test/webserver_function.go @@ -0,0 +1,145 @@ +package suite + +import ( + "bufio" + _ "embed" + "fmt" + "net/http" + "os" + "time" + + "github.com/gorilla/websocket" + + "github.com/sirupsen/logrus" +) + +//go:embed webserver/index.html +var indexHTML []byte + +//go:embed webserver/submit.js +var submit []byte + +//go:embed webserver/logs.js +var logs []byte + +//go:embed webserver/toast.js +var toast []byte + +var upgrader = websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +func logStreamHandler(w http.ResponseWriter, r *http.Request) { + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + logrus.Printf("WebSocket upgrade error: %v", err) + return + } + defer conn.Close() + + filePath := "log.log" + + // Open the log file + file, err := os.Open(filePath) + if err != nil { + logrus.Println(err) + return + } + defer file.Close() + + // Create a scanner to read the log file line by line + for { + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + "\n" + // Send each log line to the client + if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + fmt.Println(err) + //return + } + + // Sleep for a short duration to simulate real-time updates + time.Sleep(100 * time.Millisecond) + } + if err := scanner.Err(); err != nil { + logrus.Printf("Error reading log file: %v", err) + } + + time.Sleep(1 * time.Second) + } + +} + +type RequstedData struct { + SelectedOptions interface{} `json:"selectedOptions"` +} +type ResponseData struct { + Message string `json:"message"` +} + +func flattenData(data interface{}, result []string) []string { + switch v := data.(type) { + case string: + result = append(result, v) + case []interface{}: + for _, item := range v { + result = flattenData(item, result) + } + case map[string]interface{}: + for key, item := range v { + if key == "selectedOptions" { + result = flattenData(item, result) + } + result = flattenData(item, result) + } + } + return result +} +func HandlereqFunc() { + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "text/html". + w.Header().Set("Content-Type", "text/html") + // Write the embedded HTML content to the response. + _, err := w.Write(indexHTML) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(submit) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(logs) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(toast) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + // Serve the static HTML file + http.HandleFunc("/logstream", logStreamHandler) + +} From 1c3eaa769ee5f6787a8e26bd78c68e06b6a1972e Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:29:28 +0200 Subject: [PATCH 07/28] fix for saving the log to be in a bif and not in a file --- cnf-certification-test/suite_test.go | 33 +++++--------------- cnf-certification-test/webserver/index.html | 5 +-- cnf-certification-test/webserver/logs.js | 2 +- cnf-certification-test/webserver_function.go | 24 ++++---------- 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index bbf9bed63..12a7b4bd9 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,6 +17,7 @@ package suite import ( + "bytes" _ "embed" "encoding/json" "flag" @@ -298,37 +299,18 @@ func StartServer() { http.HandleFunc("/runFunction", RunHandler) - fmt.Println("Server is running on :8080...") - if err := http.ListenAndServe(":8080", nil); err != nil { + fmt.Println("Server is running on :8084...") + if err := http.ListenAndServe(":8084", nil); err != nil { panic(err) } } // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - // Create or open a log file - filename := "log.log" - if _, err := os.Stat(filename); err == nil { - // If it exists, truncate it to remove the contents - file, err := os.OpenFile(filename, os.O_TRUNC, 0) - if err != nil { - // Handle the error if necessary - panic(err) - } - file.Close() - } - logFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) - if err != nil { - panic(err) - } - logrus.SetOutput(logFile) - originalStdout := os.Stdout - os.Stdout = logFile - // Read the YAML file - defer func() { - os.Stdout = originalStdout - logFile.Close() - }() + + Buf = bytes.NewBufferString(aString) + + logrus.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) @@ -407,6 +389,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() + // fetch the current config suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration() // adjust it diff --git a/cnf-certification-test/webserver/index.html b/cnf-certification-test/webserver/index.html index dbac2fdbb..07611612a 100644 --- a/cnf-certification-test/webserver/index.html +++ b/cnf-certification-test/webserver/index.html @@ -138,10 +138,6 @@ await toast({ heading, message, state, timeout: 20_000 }); }); document.getElementById('show-logs').addEventListener('click', async function(event) { - const code = document - .getElementById('logs') - .querySelector('rh-code-block'); - code.textContent = ''; await import('./logs.js') }); @@ -166,6 +162,7 @@

CNF Certification Test

diff --git a/cnf-certification-test/webserver/logs.js b/cnf-certification-test/webserver/logs.js index a3624f210..4de5b4968 100644 --- a/cnf-certification-test/webserver/logs.js +++ b/cnf-certification-test/webserver/logs.js @@ -1,6 +1,6 @@ import '@rhds/elements/rh-code-block/rh-code-block.js'; -const socket = new WebSocket('ws://localhost:8080/logstream'); +const socket = new WebSocket('ws://localhost:8084/logstream'); const code = document .getElementById('logs') .querySelector('rh-code-block'); diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 30bb3e787..5cbeac9f0 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -2,11 +2,10 @@ package suite import ( "bufio" + "bytes" _ "embed" "fmt" "net/http" - "os" - "time" "github.com/gorilla/websocket" @@ -24,6 +23,8 @@ var logs []byte //go:embed webserver/toast.js var toast []byte +var Buf *bytes.Buffer +var aString string var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { @@ -38,36 +39,23 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { return } defer conn.Close() - - filePath := "log.log" - - // Open the log file - file, err := os.Open(filePath) - if err != nil { - logrus.Println(err) - return - } - defer file.Close() - // Create a scanner to read the log file line by line for { - scanner := bufio.NewScanner(file) + scanner := bufio.NewScanner(Buf) for scanner.Scan() { line := scanner.Text() + "\n" // Send each log line to the client if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { fmt.Println(err) - //return + return } - // Sleep for a short duration to simulate real-time updates - time.Sleep(100 * time.Millisecond) } if err := scanner.Err(); err != nil { logrus.Printf("Error reading log file: %v", err) + return } - time.Sleep(1 * time.Second) } } From c65f25a354af94bd7c4140b4342d548762a391f3 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:15:05 +0200 Subject: [PATCH 08/28] add bufer implemntation fir logs --- cnf-certification-test/suite_test.go | 3 ++- cnf-certification-test/webserver/logs.js | 2 +- cnf-certification-test/webserver_function.go | 8 +++++--- go.mod | 2 ++ go.sum | 21 ++++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 12a7b4bd9..47949fc25 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -23,6 +23,7 @@ import ( "flag" "fmt" "io" + logl "log" "net/http" "os" "path/filepath" @@ -311,7 +312,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { Buf = bytes.NewBufferString(aString) logrus.SetOutput(Buf) - + logl.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) var data RequstedData diff --git a/cnf-certification-test/webserver/logs.js b/cnf-certification-test/webserver/logs.js index 4de5b4968..81b3f4c05 100644 --- a/cnf-certification-test/webserver/logs.js +++ b/cnf-certification-test/webserver/logs.js @@ -7,5 +7,5 @@ const code = document code.textContent = ''; // Handle incoming log messages socket.addEventListener('message', function (event) { - code.textContent += event.data + '\n'; + code.innerHTML += event.data + '\n'; }); \ No newline at end of file diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 5cbeac9f0..1d9975ec7 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -8,7 +8,7 @@ import ( "net/http" "github.com/gorilla/websocket" - + "github.com/robert-nix/ansihtml" "github.com/sirupsen/logrus" ) @@ -43,9 +43,11 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { for { scanner := bufio.NewScanner(Buf) for scanner.Scan() { - line := scanner.Text() + "\n" + line := scanner.Bytes() + line = append(ansihtml.ConvertToHTML(line), []byte("
")...) + // Send each log line to the client - if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + if err := conn.WriteMessage(websocket.TextMessage, line); err != nil { fmt.Println(err) return } diff --git a/go.mod b/go.mod index bdcde7895..b23000178 100644 --- a/go.mod +++ b/go.mod @@ -216,8 +216,10 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 + github.com/onsi/ginkgo v1.16.5 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e github.com/redhat-openshift-ecosystem/openshift-preflight v0.0.0-20231018165107-f04b78186455 + github.com/robert-nix/ansihtml v1.0.1 github.com/test-network-function/oct v0.0.2 github.com/test-network-function/privileged-daemonset v1.0.13 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 3b5137cd1..e7bc701a9 100644 --- a/go.sum +++ b/go.sum @@ -189,6 +189,8 @@ github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6 github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -223,6 +225,7 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= @@ -350,6 +353,7 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -467,12 +471,17 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -533,6 +542,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/robert-nix/ansihtml v1.0.1 h1:VTiyQ6/+AxSJoSSLsMecnkh8i0ZqOEdiRl/odOc64fc= +github.com/robert-nix/ansihtml v1.0.1/go.mod h1:CJwclxYaTPc2RfcxtanEACsYuTksh4yDXcNeHHKZINE= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= @@ -705,6 +716,7 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -727,6 +739,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -769,6 +782,7 @@ golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -780,7 +794,10 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -801,6 +818,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -888,6 +906,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1017,6 +1036,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -1026,6 +1046,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From f36b1664d42b7f6a18018407f0884e57bdc9416f Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:18:11 +0200 Subject: [PATCH 09/28] update the flag --- cnf-certification-test/suite_test.go | 11 +++++------ run-cnf-suites.sh | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 47949fc25..3eba1c2e6 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -32,7 +32,6 @@ import ( "time" "github.com/onsi/ginkgo/v2" - "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" "github.com/test-network-function/cnf-certification-test/cnf-certification-test/results" "github.com/test-network-function/cnf-certification-test/pkg/claimhelper" @@ -64,7 +63,7 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" - serverModeFlag = "server-mode" + serverModeFlag = "serverMode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" defaultServerMode = "false" @@ -311,10 +310,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { Buf = bytes.NewBufferString(aString) - logrus.SetOutput(Buf) + log.SetOutput(Buf) logl.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field - logrus.Info(jsonData) + log.Info(jsonData) var data RequstedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) @@ -348,9 +347,9 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { // Copy the uploaded file to the server file os.Setenv("KUBECONFIG", handler.Filename) - logrus.Infof("KUBECONFIG : %v", handler.Filename) + log.Infof("KUBECONFIG : %v", handler.Filename) - logrus.Infof("Labels filter : %v", flattenedOptions) + log.Infof("Labels filter : %v", flattenedOptions) // Set the output of the logger to the log file diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 7be443e4b..197a51c84 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -95,9 +95,9 @@ fi # Specify Junit report file name. GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ +-serverMode $SERVER_RUN \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --server-mode $SERVER_RUN \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ @@ -112,7 +112,7 @@ echo "Report will be output to '$OUTPUT_LOC'" echo "ginkgo arguments '${GINKGO_ARGS}'" LABEL_STRING='' -if [ -z "$LABEL" ]; then +if [ -z "$LABEL" ] && ([ -z "$SERVER_RUN" ] || [ $SERVER_RUN == false ]); then echo "No test label (-l) was set, so only diagnostic functions will run." else LABEL_STRING="-ginkgo.label-filter=${LABEL}" From 0d1debacb0eb76d8d1d20e28b26f6a154a1bea18 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:39:15 +0200 Subject: [PATCH 10/28] few changes for linter --- cnf-certification-test/suite_test.go | 58 ++++---------------- cnf-certification-test/webserver_function.go | 10 ++-- go.mod | 1 - go.sum | 21 ------- 4 files changed, 15 insertions(+), 75 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 3eba1c2e6..5b94a6a45 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -174,7 +174,6 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { log.Errorf("Configuration node missing because of: %s", err) t.FailNow() } - claimData.Nodes = claimhelper.GenerateNodes() claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) return claimData, claimRoot @@ -182,8 +181,6 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { - - // Keep the main program running ginkgoConfig, _ := ginkgo.GinkgoConfiguration() if *serverMode == "false" { claimData, claimRoot := PreRun(t) @@ -205,15 +202,14 @@ func TestTest(t *testing.T) { env = provider.GetTestEnvironment() ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } - ContinueRun(t, diagnosticMode, env, claimData, claimRoot) + ContinueRun(diagnosticMode, &env, claimData, claimRoot) } else { go StartServer() select {} } } -func ContinueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { - +func ContinueRun(diagnosticMode bool, env *provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -294,24 +290,28 @@ func incorporateVersions(claimData *claim.Claim) { } } func StartServer() { - + server := &http.Server{ + Addr: ":8084", // Server address + ReadTimeout: 10 * time.Second, // Maximum duration for reading the entire request + WriteTimeout: 10 * time.Second, // Maximum duration for writing the entire response + IdleTimeout: 120 * time.Second, // Maximum idle duration before closing the connection + } HandlereqFunc() http.HandleFunc("/runFunction", RunHandler) fmt.Println("Server is running on :8084...") - if err := http.ListenAndServe(":8084", nil); err != nil { + if err := server.ListenAndServe(); err != nil { panic(err) } } // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - Buf = bytes.NewBufferString(aString) - log.SetOutput(Buf) logl.SetOutput(Buf) + jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) var data RequstedData @@ -350,40 +350,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { log.Infof("KUBECONFIG : %v", handler.Filename) log.Infof("Labels filter : %v", flattenedOptions) - - // Set the output of the logger to the log file - - /*data, err := os.ReadFile("tnf_config.yml") - if err != nil { - log.Fatalf("Error reading YAML file: %v", err) - } - - // Unmarshal the YAML data into a Config struct - var config configuration.TestConfiguration - - err = yaml.Unmarshal(data, &config) - if err != nil { - log.Fatalf("Error unmarshaling YAML: %v", err) - } - - // Modify the configuration - var namespace []configuration.Namespace - namespace = append(namespace, configuration.Namespace{Name: requestData.Field3}) - - config.TargetNameSpaces = namespace // Change the port to a new value - - // Serialize the modified config back to YAML format - newData, err := yaml.Marshal(&config) - if err != nil { - log.Fatalf("Error marshaling YAML: %v", err) - } - - // Write the modified YAML data back to the file - err = os.WriteFile("tnf_config.yml", newData, os.ModePerm) - if err != nil { - log.Fatalf("Error writing YAML file: %v", err) - } - */ t := testing.T{} claimData, claimRoot := PreRun(&t) var env provider.TestEnvironment @@ -400,7 +366,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) - ContinueRun(&t, false, env, claimData, claimRoot) + ContinueRun(false, &env, claimData, claimRoot) // Return the result as JSON response := struct { Message string `json:"Message"` @@ -415,12 +381,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { } // Set the Content-Type header to specify that the response is JSON w.Header().Set("Content-Type", "application/json") - // Write the JSON response to the client _, err = w.Write(jsonResponse) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - } diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 1d9975ec7..cbc942081 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -51,15 +51,12 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { fmt.Println(err) return } - } if err := scanner.Err(); err != nil { logrus.Printf("Error reading log file: %v", err) return } - } - } type RequstedData struct { @@ -88,7 +85,6 @@ func flattenData(data interface{}, result []string) []string { return result } func HandlereqFunc() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Set the content type to "text/html". w.Header().Set("Content-Type", "text/html") @@ -96,6 +92,7 @@ func HandlereqFunc() { _, err := w.Write(indexHTML) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -106,6 +103,7 @@ func HandlereqFunc() { _, err := w.Write(submit) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -116,6 +114,7 @@ func HandlereqFunc() { _, err := w.Write(logs) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -126,10 +125,9 @@ func HandlereqFunc() { _, err := w.Write(toast) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) - // Serve the static HTML file http.HandleFunc("/logstream", logStreamHandler) - } diff --git a/go.mod b/go.mod index fc2ba4694..2aacac0db 100644 --- a/go.mod +++ b/go.mod @@ -214,7 +214,6 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 - github.com/onsi/ginkgo v1.16.5 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e github.com/redhat-openshift-ecosystem/openshift-preflight v0.0.0-20231018165107-f04b78186455 github.com/robert-nix/ansihtml v1.0.1 diff --git a/go.sum b/go.sum index 5a39a64a1..3f1c70661 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,6 @@ github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6 github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -214,7 +212,6 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= @@ -337,7 +334,6 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -455,17 +451,12 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -528,7 +519,6 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/robert-nix/ansihtml v1.0.1 h1:VTiyQ6/+AxSJoSSLsMecnkh8i0ZqOEdiRl/odOc64fc= github.com/robert-nix/ansihtml v1.0.1/go.mod h1:CJwclxYaTPc2RfcxtanEACsYuTksh4yDXcNeHHKZINE= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= @@ -696,7 +686,6 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -719,7 +708,6 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -760,7 +748,6 @@ golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -772,10 +759,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -796,7 +780,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -881,7 +864,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1004,7 +986,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -1013,8 +994,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From de14d5978b460793645054093af29b1f346bf10c Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:48:56 +0200 Subject: [PATCH 11/28] Update run-cnf-suites.sh --- run-cnf-suites.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 197a51c84..e533eae2b 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -112,7 +112,7 @@ echo "Report will be output to '$OUTPUT_LOC'" echo "ginkgo arguments '${GINKGO_ARGS}'" LABEL_STRING='' -if [ -z "$LABEL" ] && ([ -z "$SERVER_RUN" ] || [ $SERVER_RUN == false ]); then +if [ -z "$LABEL" ] && { [ -z "$SERVER_RUN" ] || [ "$SERVER_RUN" == "false" ]; }; then echo "No test label (-l) was set, so only diagnostic functions will run." else LABEL_STRING="-ginkgo.label-filter=${LABEL}" From 154f4816e2be664d324e432774825619e1341afd Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:53:48 +0200 Subject: [PATCH 12/28] udpate typos --- cnf-certification-test/suite_test.go | 2 +- cnf-certification-test/webserver_function.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 5b94a6a45..f543f2ef7 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -314,7 +314,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) - var data RequstedData + var data RequestedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index cbc942081..d804a2938 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -59,7 +59,7 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { } } -type RequstedData struct { +type RequestedData struct { SelectedOptions interface{} `json:"selectedOptions"` } type ResponseData struct { From 8e4ae74b14c1df4a9b86e4ff804269036c279a19 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:34:28 +0200 Subject: [PATCH 13/28] david comments --- cnf-certification-test/suite_test.go | 15 ++++++++------- .../{ => webserver}/webserver_function.go | 19 +++++++++---------- run-cnf-suites.sh | 8 +------- 3 files changed, 18 insertions(+), 24 deletions(-) rename cnf-certification-test/{ => webserver}/webserver_function.go (90%) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index f543f2ef7..7f1b1a12a 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -23,7 +23,7 @@ import ( "flag" "fmt" "io" - logl "log" + rlog "log" "net/http" "os" "path/filepath" @@ -52,6 +52,7 @@ import ( _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/performance" _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/platform" _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/preflight" + "github.com/test-network-function/cnf-certification-test/cnf-certification-test/webserver" "github.com/test-network-function/cnf-certification-test/internal/clientsholder" "github.com/test-network-function/cnf-certification-test/pkg/configuration" "github.com/test-network-function/cnf-certification-test/pkg/diagnostics" @@ -296,7 +297,7 @@ func StartServer() { WriteTimeout: 10 * time.Second, // Maximum duration for writing the entire response IdleTimeout: 120 * time.Second, // Maximum idle duration before closing the connection } - HandlereqFunc() + webserver.HandlereqFunc() http.HandleFunc("/runFunction", RunHandler) @@ -308,18 +309,18 @@ func StartServer() { // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - Buf = bytes.NewBufferString(aString) - log.SetOutput(Buf) - logl.SetOutput(Buf) + webserver.Buf = bytes.NewBufferString("") + log.SetOutput(webserver.Buf) + rlog.SetOutput(webserver.Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) - var data RequestedData + var data webserver.RequestedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } var flattenedOptions []string - flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) + flattenedOptions = webserver.FlattenData(data.SelectedOptions, flattenedOptions) // Get the file from the request file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver/webserver_function.go similarity index 90% rename from cnf-certification-test/webserver_function.go rename to cnf-certification-test/webserver/webserver_function.go index d804a2938..1069432f6 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver/webserver_function.go @@ -1,4 +1,4 @@ -package suite +package webserver import ( "bufio" @@ -12,19 +12,18 @@ import ( "github.com/sirupsen/logrus" ) -//go:embed webserver/index.html +//go:embed index.html var indexHTML []byte -//go:embed webserver/submit.js +//go:embed submit.js var submit []byte -//go:embed webserver/logs.js +//go:embed logs.js var logs []byte -//go:embed webserver/toast.js +//go:embed toast.js var toast []byte var Buf *bytes.Buffer -var aString string var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { @@ -66,20 +65,20 @@ type ResponseData struct { Message string `json:"message"` } -func flattenData(data interface{}, result []string) []string { +func FlattenData(data interface{}, result []string) []string { switch v := data.(type) { case string: result = append(result, v) case []interface{}: for _, item := range v { - result = flattenData(item, result) + result = FlattenData(item, result) } case map[string]interface{}: for key, item := range v { if key == "selectedOptions" { - result = flattenData(item, result) + result = FlattenData(item, result) } - result = flattenData(item, result) + result = FlattenData(item, result) } } return result diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index e533eae2b..17e48283e 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -52,13 +52,7 @@ while [[ $1 == -* ]]; do fi ;; -s) - if (($# > 1)); then - SERVER_RUN=$2 - shift - else - echo >&2 '-s requires an argument' - exit 1 - fi + SERVER_RUN=true ;; -l | --label) while (("$#" >= 2)) && ! [[ $2 = --* ]] && ! [[ $2 = -* ]]; do From 2fbd6a785baa32572fbefb5c17fb8dd6ea019292 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:14:09 +0200 Subject: [PATCH 14/28] update the flag --- cnf-certification-test/suite_test.go | 9 ++++----- run-cnf-suites.sh | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 7f1b1a12a..60b2325c4 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -67,7 +67,7 @@ const ( serverModeFlag = "serverMode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" - defaultServerMode = "false" + defaultServerMode = false ) var ( @@ -87,7 +87,7 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string - serverMode *string + serverMode *bool ) func init() { @@ -95,8 +95,7 @@ func init() { "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") - serverMode = flag.String(serverModeFlag, defaultServerMode, - "run test with webserver") + serverMode = flag.Bool("serverMode", defaultServerMode, "run test with webserver") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -183,7 +182,7 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { ginkgoConfig, _ := ginkgo.GinkgoConfiguration() - if *serverMode == "false" { + if !*serverMode { claimData, claimRoot := PreRun(t) var diagnosticMode bool // Diagnostic functions will run when no labels are provided. diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 17e48283e..625be8052 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -89,7 +89,6 @@ fi # Specify Junit report file name. GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ --serverMode $SERVER_RUN \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ @@ -97,6 +96,10 @@ GINKGO_ARGS="\ -test.v\ " +if [ "$SERVER_RUN" = "true" ]; then + GINKGO_ARGS="$GINKGO_ARGS -serverMode" +fi + if [[ $LABEL == "all" ]]; then LABEL='common,extended,faredge,telco' fi From d4524a80405fb525f19db38070b00019a23ccffa Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:43:02 +0300 Subject: [PATCH 15/28] website for our cnf to run need to call ./run-cnf-suites.sh -l lifecycle -s true -s new filed mean if i want to run that from the website --- cnf-certification-test/amalpro/index.html | 247 ++++++++++++++ cnf-certification-test/amalpro/logs.js | 13 + cnf-certification-test/amalpro/submit.js | 48 +++ cnf-certification-test/amalpro/toast.js | 53 +++ cnf-certification-test/index.html | 260 ++++++++++++++ cnf-certification-test/log.log | 395 ++++++++++++++++++++++ cnf-certification-test/suite_test.go | 353 +++++++++++++++++-- 7 files changed, 1340 insertions(+), 29 deletions(-) create mode 100644 cnf-certification-test/amalpro/index.html create mode 100644 cnf-certification-test/amalpro/logs.js create mode 100644 cnf-certification-test/amalpro/submit.js create mode 100644 cnf-certification-test/amalpro/toast.js create mode 100644 cnf-certification-test/index.html create mode 100644 cnf-certification-test/log.log diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/amalpro/index.html new file mode 100644 index 000000000..14b632651 --- /dev/null +++ b/cnf-certification-test/amalpro/index.html @@ -0,0 +1,247 @@ + + + + + + CNF Certification Test + + + + + + + + + + + + +
+ Red Hat +
+ +
+

CNF Certification Test

+ +
+ + +
+ Environment Configuration + + +
+ +
+ TNF Configuration + + + + + + +
+ +
+ Select a Test + + + +
+ + Run Certification Test +
+ Show Log +
+ + +

Logs

+ No Logs Found + Close +
+ + + + + + © 2022 Red Hat, Inc. + + + + + ({ ...acc, + [key]: key in acc ? [acc[key], val] : val + }), {}); + + delete fields.submit; + console.log(fields); + + // Send an HTTP request to the server to run the function + let heading; + let message; + let state = 'success'; + + try { + const data = await fetch('/runFunction', { + method: 'POST', + headers: { 'Content-Type': 'application/json', }, + body: JSON.stringify(fields), + }).then(response => { + if (response.ok) { + return response.json(); + } else { + throw new Error(response.statusText); + } + }); + + heading = 'Success'; + message = data.Message; + + console.log(data); + } catch (error) { + console.error(error); + heading = 'Error' + message = error.message; + state = 'danger'; + } finally { + form.elements.submit.disabled = false; + for (const el of form.elements) if (el instanceof HTMLFieldSetElement) el.disabled = false + } + + return { heading, message, state }; + } \ No newline at end of file diff --git a/cnf-certification-test/amalpro/toast.js b/cnf-certification-test/amalpro/toast.js new file mode 100644 index 000000000..1516826de --- /dev/null +++ b/cnf-certification-test/amalpro/toast.js @@ -0,0 +1,53 @@ +import '@rhds/elements/rh-alert/rh-alert.js'; + +export async function toast({ + heading, + message, + state = 'info', + timeout = 8_000, +}) { + await import('@rhds/elements/rh-alert/rh-alert.js'); + const h2 = document.createElement('h2'); + h2.textContent = heading; + h2.slot = 'header'; + const alert = document.createElement('rh-alert'); + alert.setAttribute('aria-live', 'polite'); + alert.dismissable = true; + alert.state = state; + alert.classList.add('toast'); + alert.style.position = 'fixed'; + alert.style.margin = '0'; + alert.style.setProperty('z-index', '1000'); + alert.style.setProperty('inset-inline-end', 'var(--rh-space-xl, 24px)'); + alert.style.setProperty('inset-block-start', 'var(--rh-space-xl, 24px)'); + alert.append(h2); + if (message) { + const p = document.createElement('p'); + p.textContent = message; + alert.append(message); + } + + alert.animate({ translate: ['100% 0', '0 0'] }, { duration: 200 }); + + await Promise.all(Array.from(document.querySelectorAll('rh-alert.toast'), toast => + // TODO: handle more than 2 toasts + toast.animate({ + translate: [ + '0 auto', + '0 calc(100% + 20px)', + ], + }, { + duration: 200, + composite: 'accumulate', + rangeEnd: '100%', + fill: 'forwards', + }).finished)); + + setTimeout(() => { + if (alert.isConnected) { + alert.remove(); + } + }, timeout); + + document.body.append(alert); +} \ No newline at end of file diff --git a/cnf-certification-test/index.html b/cnf-certification-test/index.html new file mode 100644 index 000000000..f4e096447 --- /dev/null +++ b/cnf-certification-test/index.html @@ -0,0 +1,260 @@ + + + + + + + + + + + Run Function + + + + + + + + + Red Hat logo +

CNF CERTIFICATION TEST WEBPAGE

+
+
+
+ + +

Environment Configuration

+
+ + + + + +

TNF Configuration

+
+ + + + + + + +

Selecet a Test

+
+ +
+
+ + + +
+
+
+
+ +

Click Run Certification Test

+ Run Certification Test +

Show Certification Test log

+ Show Log + + +
+

Log Output

+

+		X
+    
+ + + + + + + © 2022 Red Hat, Inc. + + + \ No newline at end of file diff --git a/cnf-certification-test/log.log b/cnf-certification-test/log.log new file mode 100644 index 000000000..f68b6425e --- /dev/null +++ b/cnf-certification-test/log.log @@ -0,0 +1,395 @@ +INFO [Oct 19 17:05:52.390][suite_test.go: 398] KUBECONFIG : /Users/amal/Downloads/kubeconfig.3nodes +INFO [Oct 19 17:05:52.390][suite_test.go: 400] Labels filter : lifecycle +INFO [Oct 19 17:05:52.390][suite_test.go: 436] /Users/amal/Downloads/kubeconfig.3nodes +INFO [Oct 19 17:05:52.390][utils.go: 66] Saving environment variables & parameters. +INFO [Oct 19 17:05:52.390][utils.go: 71] Environment: {Home:/Users/amal Kubeconfig:/Users/amal/Downloads/kubeconfig.3nodes ConfigurationPath:tnf_config.yml NonIntrusiveOnly:false LogLevel:debug OfflineDB: AllowPreflightInsecure:false PfltDockerconfig: IncludeWebFilesInOutputFolder:false OmitArtifactsZipFile:false EnableDataCollection:false} +INFO [Oct 19 17:05:52.390][suite_test.go: 122] Log level set to: debug +INFO [Oct 19 17:05:52.391][suite_test.go: 452] Ginkgo Version : 2.12.1 +INFO [Oct 19 17:05:52.391][suite_test.go: 453] Labels filter : lifecycle +INFO [Oct 19 17:05:52.391][suite_test.go: 128] &{/Users/amal /Users/amal/Downloads/kubeconfig.3nodes tnf_config.yml false debug false false false false} +INFO [Oct 19 17:05:52.391][clientsholder.go: 169] Creating k8s go-clients holder. +INFO [Oct 19 17:05:53.857][utils.go: 42] Loading config from file: tnf_config.yml +WARNING[Oct 19 17:05:53.858][utils.go: 55] No namespace configured for the debug DaemonSet. Defaulting to namespace cnf-suite +INFO [Oct 19 17:06:05.785][main.go: 436] namespace cnf-suite deleted +INFO [Oct 19 17:06:06.411][main.go: 175] Checking if the daemonset exists +INFO [Oct 19 17:06:06.566][main.go: 178] daemonset tnf-debug does not exist, err=daemonsets.apps "tnf-debug" not found +INFO [Oct 19 17:06:06.566][main.go: 226] Creating daemonset tnf-debug +INFO [Oct 19 17:06:07.344][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:0 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:0 NumberUnavailable:3 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:12.502][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:12.502][main.go: 281] All the debug pods are ready. +INFO [Oct 19 17:06:12.502][main.go: 237] Daemonset is ready +INFO [Oct 19 17:06:12.811][main.go: 243] Successfully created daemonset tnf-debug +INFO [Oct 19 17:06:13.283][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} +INFO [Oct 19 17:06:13.283][main.go: 281] All the debug pods are ready. +INFO [Oct 19 17:06:13.441][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:06:13.441][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:06:13.609][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:06:13.764][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:06:14.253][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:06:14.583][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:06:16.090][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:06:16.243][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:06:16.398][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:06:16.398][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:06:17.018][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:06:17.324][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:06:17.478][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:06:18.760][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:06:18.760][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:06:18.761][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:06:18.914][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:06:18.914][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:19.091][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:19.265][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:06:19.437][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:06:19.437][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:06:19.437][provider.go: 311] Completed the test environment build process in 25.58 seconds +This will be written to the log file. +DEBUG [Oct 19 17:06:36.971][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:06:37.282][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:06:37.282][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:06:37.601][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:06:37.757][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:06:38.398][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:06:38.727][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:06:40.202][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:06:40.396][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:06:40.554][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:06:40.554][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:06:41.179][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:06:41.497][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:06:41.652][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:06:42.947][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:06:42.947][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:06:42.948][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:06:43.101][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:06:43.101][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:43.269][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:06:43.438][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:06:43.613][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:06:43.614][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:06:43.614][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:06:43.614][provider.go: 311] Completed the test environment build process in 6.64 seconds +DEBUG [Oct 19 17:06:43.614][suite.go: 60] Entering access-control suite +DEBUG [Oct 19 17:06:43.614][suite.go: 46] Entering affiliated-certification suite +DEBUG [Oct 19 17:06:43.614][suite.go: 54] Entering lifecycle suite +DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering manageability suite +DEBUG [Oct 19 17:06:43.615][suite.go: 52] Entering networking suite +DEBUG [Oct 19 17:06:43.615][suite.go: 40] Entering observability suite +DEBUG [Oct 19 17:06:43.615][suite.go: 35] Entering operator suite +DEBUG [Oct 19 17:06:43.615][suite.go: 49] Entering platform-alteration suite +DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering preflight suite +DEBUG [Oct 19 17:06:43.615][suite.go: 43] Skipping the preflight suite because the Docker Config file is not provided. +DEBUG [Oct 19 17:06:43.615][suite.go: 44] Entering performance suite +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-0 ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-1 ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pre stop lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-0 ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-1 ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf post start lifecycle +DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-0 ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-1 ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pull policy, should be IfNotPresent +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-0 ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-1 ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf readiness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-0 ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-1 ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf liveness probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-0 ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-1 ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf startup probe +DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf startup probe +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-0 owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-1 owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-2fk6c owner reference +DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-wmj2m owner reference +INFO [Oct 19 17:06:43.618][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. +INFO [Oct 19 17:06:43.618][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:06:43.773][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:06:43.773][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:06:43.933][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:06:43.933][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:06:43.933][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:06:43.933][podrecreation.go: 51] Performing cordon operation on node clus0-2 +DEBUG [Oct 19 17:06:44.405][suite.go: 570] node: clus0-2 cordoned +DEBUG [Oct 19 17:06:44.406][suite.go: 576] draining node: clus0-2 with timeout: 8m0s +DEBUG [Oct 19 17:06:44.406][podrecreation.go: 113] deleting ns=tnf pod=test-0 with deleteForeground mode +DEBUG [Oct 19 17:06:45.574][podrecreation.go: 159] ns=tnf pod=test-0 deleted +INFO [Oct 19 17:06:45.574][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. +INFO [Oct 19 17:06:45.575][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:06:45.730][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:06:45.730][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +INFO [Oct 19 17:06:45.888][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:06:45.888][podsets.go: 199] Not ready StatefulSets: [tnf:test] +INFO [Oct 19 17:07:00.888][podsets.go: 192] Checking Deployments readiness of Deployments [] +INFO [Oct 19 17:07:00.889][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:01.055][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:01.056][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:01.056][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:01.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 +INFO [Oct 19 17:07:02.642][podrecreation.go: 51] Performing cordon operation on node clus0-0 +DEBUG [Oct 19 17:07:03.963][suite.go: 570] node: clus0-0 cordoned +DEBUG [Oct 19 17:07:03.964][suite.go: 576] draining node: clus0-0 with timeout: 9m0s +DEBUG [Oct 19 17:07:03.964][podrecreation.go: 113] deleting ns=tnf pod=test-1 with deleteForeground mode +DEBUG [Oct 19 17:07:04.299][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-wmj2m with deleteForeground mode +DEBUG [Oct 19 17:07:06.065][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-wmj2m deleted +DEBUG [Oct 19 17:07:06.233][podrecreation.go: 159] ns=tnf pod=test-1 deleted +INFO [Oct 19 17:07:06.233][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. +INFO [Oct 19 17:07:06.233][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +INFO [Oct 19 17:07:06.400][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +INFO [Oct 19 17:07:06.572][podsets.go: 198] Not ready Deployments: [tnf:test] +INFO [Oct 19 17:07:06.572][podsets.go: 199] Not ready StatefulSets: [tnf:test] +INFO [Oct 19 17:07:21.573][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:07:21.738][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:07:21.738][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:21.907][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:21.907][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:21.907][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:21.907][podrecreation.go: 51] Performing uncordon operation on node clus0-0 +INFO [Oct 19 17:07:22.734][podrecreation.go: 51] Performing cordon operation on node clus0-1 +DEBUG [Oct 19 17:07:24.042][suite.go: 570] node: clus0-1 cordoned +DEBUG [Oct 19 17:07:24.054][suite.go: 576] draining node: clus0-1 with timeout: 8m0s +DEBUG [Oct 19 17:07:24.054][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-2fk6c with deleteForeground mode +DEBUG [Oct 19 17:07:26.465][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-2fk6c deleted +INFO [Oct 19 17:07:26.465][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. +INFO [Oct 19 17:07:26.465][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +INFO [Oct 19 17:07:26.631][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] +DEBUG [Oct 19 17:07:26.797][podsets.go: 175] statefulset: test ns: tnf is ready. +INFO [Oct 19 17:07:26.797][podsets.go: 198] Not ready Deployments: [tnf:test] +INFO [Oct 19 17:07:26.797][podsets.go: 199] Not ready StatefulSets: [] +INFO [Oct 19 17:07:41.798][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] +DEBUG [Oct 19 17:07:41.957][podsets.go: 152] deployment: test ns: tnf is ready. +INFO [Oct 19 17:07:41.957][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [] +INFO [Oct 19 17:07:41.957][podsets.go: 198] Not ready Deployments: [] +INFO [Oct 19 17:07:41.957][podsets.go: 199] Not ready StatefulSets: [] +DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready Deployments: [] +DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready StatefulSets: [] +INFO [Oct 19 17:07:41.957][podrecreation.go: 51] Performing uncordon operation on node clus0-1 +INFO [Oct 19 17:07:43.096][podrecreation.go: 51] Performing uncordon operation on node clus0-1 +INFO [Oct 19 17:07:43.579][podrecreation.go: 51] Performing uncordon operation on node clus0-0 +INFO [Oct 19 17:07:44.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 +DEBUG [Oct 19 17:07:44.692][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:07:45.020][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:07:45.020][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:07:45.193][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:07:45.355][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:07:46.004][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:07:46.340][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:07:47.722][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:07:47.881][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:07:48.038][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:07:48.055][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:07:48.678][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:07:48.997][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:07:49.152][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:07:50.462][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:07:50.630][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:07:50.630][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:07:50.810][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:07:51.020][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:07:51.390][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:07:51.391][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:07:51.391][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:07:51.391][provider.go: 311] Completed the test environment build process in 6.70 seconds +INFO [Oct 19 17:07:53.160][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:54.315][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:55.476][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:56.632][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:57.841][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:07:59.000][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:00.160][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:01.317][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:02.473][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:03.631][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:04.789][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:05.945][podsets.go: 44] deployment: test ns: tnf is not ready yet +INFO [Oct 19 17:08:07.100][podsets.go: 44] deployment: test ns: tnf is not ready yet +DEBUG [Oct 19 17:08:08.254][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:08:08.561][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:08:08.561][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:08:08.725][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:08:08.881][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:08:09.199][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:08:09.526][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:08:09.880][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:08:11.375][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:08:11.531][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:08:11.687][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:08:11.687][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:08:12.314][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:08:12.622][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:08:12.776][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:08:14.078][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:08:14.236][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:08:14.236][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:14.408][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:14.580][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:08:14.784][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:08:14.784][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:08:14.784][provider.go: 311] Completed the test environment build process in 6.53 seconds +DEBUG [Oct 19 17:08:16.369][utils.go: 38] config file already loaded, return previous element +INFO [Oct 19 17:08:16.678][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] +INFO [Oct 19 17:08:16.678][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] +DEBUG [Oct 19 17:08:16.844][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) +INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +DEBUG [Oct 19 17:08:17.001][autodiscover_operators.go: 112] Searching CSVs in namespace All +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 121] Found 2 CSVs: +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) +DEBUG [Oct 19 17:08:17.485][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target +DEBUG [Oct 19 17:08:17.810][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug +INFO [Oct 19 17:08:19.152][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. +DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} +DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new +DEBUG [Oct 19 17:08:19.305][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator +INFO [Oct 19 17:08:19.458][autodiscover_operators.go: 91] Found 0 CSVs: +DEBUG [Oct 19 17:08:19.458][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf +INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces +INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) +INFO [Oct 19 17:08:20.082][autodiscover.go: 276] OpenShift Version found: 4.13.0 +INFO [Oct 19 17:08:20.391][autodiscover_podset.go: 80] Deployment test found in ns tnf +INFO [Oct 19 17:08:20.547][autodiscover_podset.go: 113] StatefulSet test found in ns tnf +INFO [Oct 19 17:08:21.850][operators.go: 130] Found 2 unique CSVs +INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: packageserver +INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: lvms-operator.v4.13.1 +INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) +WARNING[Oct 19 17:08:22.004][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) +INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op packageserver (subs ns ) +INFO [Oct 19 17:08:22.004][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:22.179][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +INFO [Oct 19 17:08:22.351][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d +INFO [Oct 19 17:08:22.531][operators.go: 130] Found 0 unique CSVs +INFO [Oct 19 17:08:22.531][provider.go: 299] Operators found: 0 +INFO [Oct 19 17:08:22.531][provider.go: 311] Completed the test environment build process in 6.16 seconds +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-0 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-1 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-rtxbr ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-vvlwx ns: tnf has CPU requests 250 (milli) that has to be a whole unit. +INFO [Oct 19 17:08:22.636][archiver.go: 45] Compressing results artifacts into /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/20231019-170822-cnf-test-results.tar.gz +DEBUG [Oct 19 17:08:22.637][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claim.json +DEBUG [Oct 19 17:08:22.666][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/cnf-certification-tests_junit.xml +DEBUG [Oct 19 17:08:22.667][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claimjson.js +DEBUG [Oct 19 17:08:22.700][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/results.html diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 22a900793..782e94368 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,14 +17,20 @@ package suite import ( + "bufio" _ "embed" + "encoding/json" "flag" + "fmt" + "net/http" "os" "path/filepath" "testing" "time" + "github.com/gorilla/websocket" "github.com/onsi/ginkgo/v2" + "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" "github.com/test-network-function/cnf-certification-test/cnf-certification-test/results" "github.com/test-network-function/cnf-certification-test/pkg/claimhelper" @@ -56,8 +62,10 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" + serverRun = "runserver" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" + defaultServerRun = false ) var ( @@ -77,13 +85,28 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string + serveRun *bool ) +//go:embed amalpro/index.html +var indexHTML []byte + +//go:embed amalpro/submit.js +var submit []byte + +//go:embed amalpro/logs.js +var logs []byte + +//go:embed amalpro/toast.js +var toast []byte + func init() { claimPath = flag.String(claimPathFlagKey, defaultClaimPath, "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") + serveRun = flag.Bool(serverRun, defaultServerRun, + "the path for the junit format report") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -102,6 +125,7 @@ func setLogLevel() { func getK8sClientsConfigFileNames() []string { params := configuration.GetTestParameters() + logrus.Info(params) fileNames := []string{} if params.Kubeconfig != "" { fileNames = append(fileNames, params.Kubeconfig) @@ -126,6 +150,59 @@ func getGitVersion() string { return gitDisplayRelease + " ( " + GitCommit + " )" } +func startServer() { + log.Info("inside starting the server") + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "text/html". + w.Header().Set("Content-Type", "text/html") + // Write the embedded HTML content to the response. + _, err := w.Write(indexHTML) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(submit) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(logs) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(toast) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/runFunction", runHandler) + // Serve the static HTML file + http.HandleFunc("/logstream", logStreamHandler) + + fmt.Println("Server is running on :8080...") + if err := http.ListenAndServe(":8080", nil); err != nil { + panic(err) + } +} + // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { // When running unit tests, skip the suite @@ -147,43 +224,55 @@ func TestTest(t *testing.T) { log.Infof("Claim Format Version: %s", ClaimFormatVersion) log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) + log.Infof("*serveRun : %v", *serveRun) + log.Info("starting the server") + + go startServer() + // Keep the main program running // Diagnostic functions will run when no labels are provided. - var diagnosticMode bool - if ginkgoConfig.LabelFilter == "" { - log.Infof("TNF will run in diagnostic mode so no test case will be launched.") - diagnosticMode = true - } + if !*serveRun { + var diagnosticMode bool + if ginkgoConfig.LabelFilter == "" { + log.Infof("TNF will run in diagnostic mode so no test case will be launched.") + diagnosticMode = true + } - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) + // Initialize the claim with the start time, tnf version, etc. + claimRoot := claimhelper.CreateClaimRoot() + claimData := claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - // initialize abort flag - testhelper.AbortTrigger = "" + // initialize abort flag + testhelper.AbortTrigger = "" - // Run tests specs only if not in diagnostic mode, otherwise all TSs would run. - var env provider.TestEnvironment - if !diagnosticMode { - env.SetNeedsRefresh() - env = provider.GetTestEnvironment() - ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) + // Run tests specs only if not in diagnostic mode, otherwise all TSs would run. + var env provider.TestEnvironment + if !diagnosticMode { + env.SetNeedsRefresh() + env = provider.GetTestEnvironment() + ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) + } + continueRun(t, diagnosticMode, env, claimData, claimRoot) } + select {} +} + +func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -211,7 +300,7 @@ func TestTest(t *testing.T) { // Send claim file to the collector if specified by env var if configuration.GetTestParameters().EnableDataCollection { - err = collector.SendClaimFileToCollector(env.CollectorAppEndPoint, claimOutputFile, env.ExecutedBy, env.PartnerName, env.CollectorAppPassword) + err := collector.SendClaimFileToCollector(env.CollectorAppEndPoint, claimOutputFile, env.ExecutedBy, env.PartnerName, env.CollectorAppPassword) if err != nil { log.Errorf("Failed to send post request to the collector: %v", err) } @@ -264,3 +353,209 @@ func incorporateVersions(claimData *claim.Claim) { ClaimFormat: ClaimFormatVersion, } } + +var upgrader = websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +// Define an HTTP handler that triggers Ginkgo tests +func runHandler(w http.ResponseWriter, r *http.Request) { + // Run Ginkgo tests + var requestData RequestData + //var responseData ResponseData + // Parse JSON data from the request body + err := json.NewDecoder(r.Body).Decode(&requestData) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + // Create or open a log file + filename := "log.log" + if _, err := os.Stat(filename); err == nil { + // If it exists, truncate it to remove the contents + file, err := os.OpenFile(filename, os.O_TRUNC, 0) + if err != nil { + // Handle the error if necessary + panic(err) + } + file.Close() + } + logFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) + if err != nil { + panic(err) + } + logrus.SetOutput(logFile) + originalStdout := os.Stdout + os.Stdout = logFile + // Read the YAML file + defer func() { + os.Stdout = originalStdout + logFile.Close() + }() + os.Setenv("KUBECONFIG", requestData.KubeConfigPath) + logrus.Infof("KUBECONFIG : %v", requestData.KubeConfigPath) + + logrus.Infof("Labels filter : %v", requestData.SelectedOptions) + + // Set the output of the logger to the log file + + /*data, err := os.ReadFile("tnf_config.yml") + if err != nil { + log.Fatalf("Error reading YAML file: %v", err) + } + + // Unmarshal the YAML data into a Config struct + var config configuration.TestConfiguration + + err = yaml.Unmarshal(data, &config) + if err != nil { + log.Fatalf("Error unmarshaling YAML: %v", err) + } + + // Modify the configuration + var namespace []configuration.Namespace + namespace = append(namespace, configuration.Namespace{Name: requestData.Field3}) + + config.TargetNameSpaces = namespace // Change the port to a new value + + // Serialize the modified config back to YAML format + newData, err := yaml.Marshal(&config) + if err != nil { + log.Fatalf("Error marshaling YAML: %v", err) + } + + // Write the modified YAML data back to the file + err = os.WriteFile("tnf_config.yml", newData, os.ModePerm) + if err != nil { + log.Fatalf("Error writing YAML file: %v", err) + } + */ + t := testing.T{} + logrus.Infof(os.Getenv("KUBECONFIG")) + // When running unit tests, skip the suite + if os.Getenv("UNIT_TEST") != "" { + t.Skip("Skipping test suite when running unit tests") + } + + err = configuration.LoadEnvironmentVariables() + if err != nil { + log.Fatalf("could not load the environment variables, error: %v", err) + } + + // Set up logging params for logrus + loghelper.SetLogFormat() + setLogLevel() + + ginkgoConfig, _ := ginkgo.GinkgoConfiguration() + log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) + log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) + + // Initialize the claim with the start time, tnf version, etc. + claimRoot := claimhelper.CreateClaimRoot() + claimData := claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) + + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + + // initialize abort flag + testhelper.AbortTrigger = "" + + fmt.Println("This will be written to the log file.") + var env provider.TestEnvironment + env.SetNeedsRefresh() + env = provider.GetTestEnvironment() + // fetch the current config + suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration() + // adjust it + suiteConfig.SkipStrings = []string{"NEVER-RUN"} + reporterConfig.FullTrace = true + reporterConfig.JUnitReport = "cnf-certification-tests_junit.xml" + // pass it in to RunSpecs + suiteConfig.LabelFilter = requestData.SelectedOptions + ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) + + continueRun(&t, false, env, claimData, claimRoot) + // Return the result as JSON + response := struct { + Message string `json:"Message"` + }{ + Message: fmt.Sprintf("Sucsses to run %s", requestData.SelectedOptions), + } + // Serialize the response data to JSON + jsonResponse, err := json.Marshal(response) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + // Set the Content-Type header to specify that the response is JSON + w.Header().Set("Content-Type", "application/json") + + // Write the JSON response to the client + _, err = w.Write(jsonResponse) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + +} + +func logStreamHandler(w http.ResponseWriter, r *http.Request) { + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + log.Printf("WebSocket upgrade error: %v", err) + return + } + defer conn.Close() + + filePath := "log.log" + + // Open the log file + file, err := os.Open(filePath) + if err != nil { + log.Println(err) + return + } + defer file.Close() + + // Create a scanner to read the log file line by line + for { + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + "\n" + // Send each log line to the client + if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + fmt.Println(err) + //return + } + + // Sleep for a short duration to simulate real-time updates + time.Sleep(100 * time.Millisecond) + } + if err := scanner.Err(); err != nil { + log.Printf("Error reading log file: %v", err) + } + + time.Sleep(1 * time.Second) + } + +} + +type RequestData struct { + KubeConfigPath string `json:"kubeConfigPath"` + SelectedOptions string `json:"selectedOptions"` +} +type ResponseData struct { + Message string `json:"message"` +} From d4dc99f18052cb82d1a7421f969524203622ca5c Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:27:58 +0300 Subject: [PATCH 16/28] a few changes(add upload file) and added the -s for server --- cnf-certification-test/amalpro/index.html | 18 +- cnf-certification-test/amalpro/logs.js | 2 - cnf-certification-test/amalpro/submit.js | 6 +- cnf-certification-test/log.log | 395 ---------------------- cnf-certification-test/suite_test.go | 83 ++++- go.mod | 1 + go.sum | 1 + run-cnf-suites.sh | 17 +- 8 files changed, 94 insertions(+), 429 deletions(-) delete mode 100644 cnf-certification-test/log.log diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/amalpro/index.html index 14b632651..dbac2fdbb 100644 --- a/cnf-certification-test/amalpro/index.html +++ b/cnf-certification-test/amalpro/index.html @@ -137,16 +137,12 @@ const { toast } = await import('./toast.js'); await toast({ heading, message, state, timeout: 20_000 }); }); - document.getElementById('show-logs').addEventListener('click', function(event) { - const socket = new WebSocket('ws://localhost:8080/logstream'); + document.getElementById('show-logs').addEventListener('click', async function(event) { const code = document - .getElementById('logs') - .querySelector('rh-code-block'); + .getElementById('logs') + .querySelector('rh-code-block'); code.textContent = ''; - // Handle incoming log messages - socket.addEventListener('message', function (event) { - code.textContent += event.data + '\n'; - }); + await import('./logs.js') }); @@ -168,11 +164,9 @@

CNF Certification Test

Environment Configuration - + type="file">
diff --git a/cnf-certification-test/amalpro/logs.js b/cnf-certification-test/amalpro/logs.js index 4f2da81dd..a3624f210 100644 --- a/cnf-certification-test/amalpro/logs.js +++ b/cnf-certification-test/amalpro/logs.js @@ -4,10 +4,8 @@ const socket = new WebSocket('ws://localhost:8080/logstream'); const code = document .getElementById('logs') .querySelector('rh-code-block'); - console.log(code) code.textContent = ''; // Handle incoming log messages socket.addEventListener('message', function (event) { code.textContent += event.data + '\n'; - console.log(code.textContent) }); \ No newline at end of file diff --git a/cnf-certification-test/amalpro/submit.js b/cnf-certification-test/amalpro/submit.js index af6eeb14f..e06d0aab9 100644 --- a/cnf-certification-test/amalpro/submit.js +++ b/cnf-certification-test/amalpro/submit.js @@ -11,7 +11,8 @@ export async function submit(form) { delete fields.submit; console.log(fields); - + formdata.append("jsonData", JSON.stringify(fields)); + // Send an HTTP request to the server to run the function let heading; let message; @@ -20,8 +21,7 @@ export async function submit(form) { try { const data = await fetch('/runFunction', { method: 'POST', - headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(fields), + body: formdata, }).then(response => { if (response.ok) { return response.json(); diff --git a/cnf-certification-test/log.log b/cnf-certification-test/log.log deleted file mode 100644 index f68b6425e..000000000 --- a/cnf-certification-test/log.log +++ /dev/null @@ -1,395 +0,0 @@ -INFO [Oct 19 17:05:52.390][suite_test.go: 398] KUBECONFIG : /Users/amal/Downloads/kubeconfig.3nodes -INFO [Oct 19 17:05:52.390][suite_test.go: 400] Labels filter : lifecycle -INFO [Oct 19 17:05:52.390][suite_test.go: 436] /Users/amal/Downloads/kubeconfig.3nodes -INFO [Oct 19 17:05:52.390][utils.go: 66] Saving environment variables & parameters. -INFO [Oct 19 17:05:52.390][utils.go: 71] Environment: {Home:/Users/amal Kubeconfig:/Users/amal/Downloads/kubeconfig.3nodes ConfigurationPath:tnf_config.yml NonIntrusiveOnly:false LogLevel:debug OfflineDB: AllowPreflightInsecure:false PfltDockerconfig: IncludeWebFilesInOutputFolder:false OmitArtifactsZipFile:false EnableDataCollection:false} -INFO [Oct 19 17:05:52.390][suite_test.go: 122] Log level set to: debug -INFO [Oct 19 17:05:52.391][suite_test.go: 452] Ginkgo Version : 2.12.1 -INFO [Oct 19 17:05:52.391][suite_test.go: 453] Labels filter : lifecycle -INFO [Oct 19 17:05:52.391][suite_test.go: 128] &{/Users/amal /Users/amal/Downloads/kubeconfig.3nodes tnf_config.yml false debug false false false false} -INFO [Oct 19 17:05:52.391][clientsholder.go: 169] Creating k8s go-clients holder. -INFO [Oct 19 17:05:53.857][utils.go: 42] Loading config from file: tnf_config.yml -WARNING[Oct 19 17:05:53.858][utils.go: 55] No namespace configured for the debug DaemonSet. Defaulting to namespace cnf-suite -INFO [Oct 19 17:06:05.785][main.go: 436] namespace cnf-suite deleted -INFO [Oct 19 17:06:06.411][main.go: 175] Checking if the daemonset exists -INFO [Oct 19 17:06:06.566][main.go: 178] daemonset tnf-debug does not exist, err=daemonsets.apps "tnf-debug" not found -INFO [Oct 19 17:06:06.566][main.go: 226] Creating daemonset tnf-debug -INFO [Oct 19 17:06:07.344][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:0 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:0 NumberUnavailable:3 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:12.502][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:12.502][main.go: 281] All the debug pods are ready. -INFO [Oct 19 17:06:12.502][main.go: 237] Daemonset is ready -INFO [Oct 19 17:06:12.811][main.go: 243] Successfully created daemonset tnf-debug -INFO [Oct 19 17:06:13.283][main.go: 264] Waiting for (3) daemonset pods to be ready: {CurrentNumberScheduled:3 NumberMisscheduled:0 DesiredNumberScheduled:3 NumberReady:3 ObservedGeneration:1 UpdatedNumberScheduled:3 NumberAvailable:3 NumberUnavailable:0 CollisionCount: Conditions:[]} -INFO [Oct 19 17:06:13.283][main.go: 281] All the debug pods are ready. -INFO [Oct 19 17:06:13.441][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:06:13.441][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:06:13.609][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:06:13.764][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:06:13.764][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:13.932][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:06:14.253][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:06:14.583][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:06:16.090][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:06:16.090][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:06:16.243][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:06:16.398][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:06:16.398][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:06:16.551][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:06:17.018][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:06:17.324][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:06:17.478][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:06:18.760][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:06:18.760][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:06:18.761][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:06:18.914][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:18.914][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:06:18.914][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:19.091][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:19.265][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:19.436][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:06:19.437][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:06:19.437][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:06:19.437][provider.go: 311] Completed the test environment build process in 25.58 seconds -This will be written to the log file. -DEBUG [Oct 19 17:06:36.971][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:06:37.282][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:06:37.282][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:06:37.601][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:06:37.757][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:06:37.757][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:38.081][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:06:38.398][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:06:38.727][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:06:40.202][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:06:40.202][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:06:40.396][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:06:40.554][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:06:40.554][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:06:40.712][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:06:41.179][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:06:41.497][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:06:41.652][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:06:42.947][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:06:42.947][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:06:42.948][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:06:43.101][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:06:43.101][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:06:43.101][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:43.269][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:06:43.438][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:06:43.613][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:06:43.614][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:06:43.614][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:06:43.614][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:06:43.614][provider.go: 311] Completed the test environment build process in 6.64 seconds -DEBUG [Oct 19 17:06:43.614][suite.go: 60] Entering access-control suite -DEBUG [Oct 19 17:06:43.614][suite.go: 46] Entering affiliated-certification suite -DEBUG [Oct 19 17:06:43.614][suite.go: 54] Entering lifecycle suite -DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering manageability suite -DEBUG [Oct 19 17:06:43.615][suite.go: 52] Entering networking suite -DEBUG [Oct 19 17:06:43.615][suite.go: 40] Entering observability suite -DEBUG [Oct 19 17:06:43.615][suite.go: 35] Entering operator suite -DEBUG [Oct 19 17:06:43.615][suite.go: 49] Entering platform-alteration suite -DEBUG [Oct 19 17:06:43.615][suite.go: 34] Entering preflight suite -DEBUG [Oct 19 17:06:43.615][suite.go: 43] Skipping the preflight suite because the Docker Config file is not provided. -DEBUG [Oct 19 17:06:43.615][suite.go: 44] Entering performance suite -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-0 ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-1 ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 204] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pre stop lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-0 ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-1 ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 220] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf post start lifecycle -DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-0 ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.616][suite.go: 237] check container container: test pod: test-1 ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 237] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf pull policy, should be IfNotPresent -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-0 ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-1 ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 252] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf readiness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-0 ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-1 ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 267] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf liveness probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-0 ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-1 ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-2fk6c ns: tnf startup probe -DEBUG [Oct 19 17:06:43.617][suite.go: 282] check container container: test pod: test-d78fbf8d6-wmj2m ns: tnf startup probe -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-0 owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-1 owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-2fk6c owner reference -DEBUG [Oct 19 17:06:43.618][suite.go: 298] check pod tnf test-d78fbf8d6-wmj2m owner reference -INFO [Oct 19 17:06:43.618][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. -INFO [Oct 19 17:06:43.618][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:06:43.773][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:06:43.773][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:06:43.933][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:06:43.933][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:06:43.933][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:06:43.933][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:06:43.933][podrecreation.go: 51] Performing cordon operation on node clus0-2 -DEBUG [Oct 19 17:06:44.405][suite.go: 570] node: clus0-2 cordoned -DEBUG [Oct 19 17:06:44.406][suite.go: 576] draining node: clus0-2 with timeout: 8m0s -DEBUG [Oct 19 17:06:44.406][podrecreation.go: 113] deleting ns=tnf pod=test-0 with deleteForeground mode -DEBUG [Oct 19 17:06:45.574][podrecreation.go: 159] ns=tnf pod=test-0 deleted -INFO [Oct 19 17:06:45.574][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. -INFO [Oct 19 17:06:45.575][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:06:45.730][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:06:45.730][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -INFO [Oct 19 17:06:45.888][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:06:45.888][podsets.go: 199] Not ready StatefulSets: [tnf:test] -INFO [Oct 19 17:07:00.888][podsets.go: 192] Checking Deployments readiness of Deployments [] -INFO [Oct 19 17:07:00.889][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:01.055][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:01.056][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:01.056][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:01.056][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:01.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 -INFO [Oct 19 17:07:02.642][podrecreation.go: 51] Performing cordon operation on node clus0-0 -DEBUG [Oct 19 17:07:03.963][suite.go: 570] node: clus0-0 cordoned -DEBUG [Oct 19 17:07:03.964][suite.go: 576] draining node: clus0-0 with timeout: 9m0s -DEBUG [Oct 19 17:07:03.964][podrecreation.go: 113] deleting ns=tnf pod=test-1 with deleteForeground mode -DEBUG [Oct 19 17:07:04.299][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-wmj2m with deleteForeground mode -DEBUG [Oct 19 17:07:06.065][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-wmj2m deleted -DEBUG [Oct 19 17:07:06.233][podrecreation.go: 159] ns=tnf pod=test-1 deleted -INFO [Oct 19 17:07:06.233][podsets.go: 190] Waiting 9m0s for 2 podsets to be ready. -INFO [Oct 19 17:07:06.233][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -INFO [Oct 19 17:07:06.400][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -INFO [Oct 19 17:07:06.572][podsets.go: 198] Not ready Deployments: [tnf:test] -INFO [Oct 19 17:07:06.572][podsets.go: 199] Not ready StatefulSets: [tnf:test] -INFO [Oct 19 17:07:21.573][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:07:21.738][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:07:21.738][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:21.907][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:21.907][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:21.907][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:21.907][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:21.907][podrecreation.go: 51] Performing uncordon operation on node clus0-0 -INFO [Oct 19 17:07:22.734][podrecreation.go: 51] Performing cordon operation on node clus0-1 -DEBUG [Oct 19 17:07:24.042][suite.go: 570] node: clus0-1 cordoned -DEBUG [Oct 19 17:07:24.054][suite.go: 576] draining node: clus0-1 with timeout: 8m0s -DEBUG [Oct 19 17:07:24.054][podrecreation.go: 113] deleting ns=tnf pod=test-d78fbf8d6-2fk6c with deleteForeground mode -DEBUG [Oct 19 17:07:26.465][podrecreation.go: 159] ns=tnf pod=test-d78fbf8d6-2fk6c deleted -INFO [Oct 19 17:07:26.465][podsets.go: 190] Waiting 8m0s for 2 podsets to be ready. -INFO [Oct 19 17:07:26.465][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -INFO [Oct 19 17:07:26.631][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [tnf:test] -DEBUG [Oct 19 17:07:26.797][podsets.go: 175] statefulset: test ns: tnf is ready. -INFO [Oct 19 17:07:26.797][podsets.go: 198] Not ready Deployments: [tnf:test] -INFO [Oct 19 17:07:26.797][podsets.go: 199] Not ready StatefulSets: [] -INFO [Oct 19 17:07:41.798][podsets.go: 192] Checking Deployments readiness of Deployments [tnf:test] -DEBUG [Oct 19 17:07:41.957][podsets.go: 152] deployment: test ns: tnf is ready. -INFO [Oct 19 17:07:41.957][podsets.go: 195] Checking StatefulSets readiness of StatefulSets [] -INFO [Oct 19 17:07:41.957][podsets.go: 198] Not ready Deployments: [] -INFO [Oct 19 17:07:41.957][podsets.go: 199] Not ready StatefulSets: [] -DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready Deployments: [] -DEBUG [Oct 19 17:07:41.957][loghelper.go: 40] Not ready StatefulSets: [] -INFO [Oct 19 17:07:41.957][podrecreation.go: 51] Performing uncordon operation on node clus0-1 -INFO [Oct 19 17:07:43.096][podrecreation.go: 51] Performing uncordon operation on node clus0-1 -INFO [Oct 19 17:07:43.579][podrecreation.go: 51] Performing uncordon operation on node clus0-0 -INFO [Oct 19 17:07:44.056][podrecreation.go: 51] Performing uncordon operation on node clus0-2 -DEBUG [Oct 19 17:07:44.692][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:07:45.020][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:07:45.020][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:07:45.193][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:07:45.355][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:07:45.355][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:07:45.678][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:07:46.004][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:07:46.340][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:07:47.722][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:07:47.723][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:07:47.881][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:07:48.038][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:07:48.055][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:07:48.213][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:07:48.678][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:07:48.997][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:07:49.152][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:07:50.462][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:07:50.463][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:07:50.630][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:07:50.630][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:07:50.630][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:07:50.810][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:07:51.020][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:07:51.390][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:07:51.391][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:07:51.391][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:07:51.391][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:07:51.391][provider.go: 311] Completed the test environment build process in 6.70 seconds -INFO [Oct 19 17:07:53.160][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:54.315][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:55.476][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:56.632][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:57.841][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:07:59.000][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:00.160][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:01.317][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:02.473][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:03.631][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:04.789][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:05.945][podsets.go: 44] deployment: test ns: tnf is not ready yet -INFO [Oct 19 17:08:07.100][podsets.go: 44] deployment: test ns: tnf is not ready yet -DEBUG [Oct 19 17:08:08.254][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:08:08.561][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:08:08.561][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:08:08.725][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:08:08.880][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:08:08.881][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:08:09.199][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:09.200][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:08:09.526][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:08:09.880][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:08:11.375][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:08:11.375][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:08:11.531][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:08:11.687][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:08:11.687][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:08:11.842][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:08:12.314][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:08:12.622][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:08:12.776][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:08:14.078][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:08:14.079][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:08:14.236][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:14.236][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:08:14.236][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:14.408][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:14.580][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.783][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:14.784][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:08:14.784][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:08:14.784][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:08:14.784][provider.go: 311] Completed the test environment build process in 6.53 seconds -DEBUG [Oct 19 17:08:16.369][utils.go: 38] config file already loaded, return previous element -INFO [Oct 19 17:08:16.678][autodiscover.go: 154] parsed pods under test labels: [{LabelKey:test-network-function.com/generic LabelValue:target}] -INFO [Oct 19 17:08:16.678][autodiscover.go: 155] parsed operators under test labels: [{LabelKey:test-network-function.com/operator1 LabelValue:new} {LabelKey:test-network-function.com/operator LabelValue:}] -DEBUG [Oct 19 17:08:16.844][autodiscover_operators.go: 135] Searching subscriptions in namespace All Namespaces -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 144] Found 2 subscriptions in the target namespaces -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: lvms-operator (ns: openshift-storage) -INFO [Oct 19 17:08:17.001][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -DEBUG [Oct 19 17:08:17.001][autodiscover_operators.go: 112] Searching CSVs in namespace All -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 121] Found 2 CSVs: -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: packageserver (ns: openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:17.169][autodiscover_operators.go: 123] CSV name: lvms-operator.v4.13.1 (ns: openshift-storage) -DEBUG [Oct 19 17:08:17.485][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/generic=target -DEBUG [Oct 19 17:08:17.810][autodiscover_pods.go: 34] Searching Pods with label test-network-function.com/app=tnf-debug -INFO [Oct 19 17:08:19.152][autodiscover_scales.go: 40] Target CRD crdexamples.test-network-function.com is not scalable. Skipping search of scalable CRs. -DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 69] Searching CSVs in namespace {tnf} -DEBUG [Oct 19 17:08:19.152][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator1=new -DEBUG [Oct 19 17:08:19.305][autodiscover_operators.go: 76] Searching CSVs with label test-network-function.com/operator -INFO [Oct 19 17:08:19.458][autodiscover_operators.go: 91] Found 0 CSVs: -DEBUG [Oct 19 17:08:19.458][autodiscover_operators.go: 135] Searching subscriptions in namespace tnf -INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 144] Found 1 subscriptions in the target namespaces -INFO [Oct 19 17:08:19.614][autodiscover_operators.go: 146] Subscriptions name: test-subscription (ns: tnf) -INFO [Oct 19 17:08:20.082][autodiscover.go: 276] OpenShift Version found: 4.13.0 -INFO [Oct 19 17:08:20.391][autodiscover_podset.go: 80] Deployment test found in ns tnf -INFO [Oct 19 17:08:20.547][autodiscover_podset.go: 113] StatefulSet test found in ns tnf -INFO [Oct 19 17:08:21.850][operators.go: 130] Found 2 unique CSVs -INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: packageserver -INFO [Oct 19 17:08:21.850][operators.go: 132] CSV: lvms-operator.v4.13.1 -INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op lvms-operator.v4.13.1 (subs lvms-operator ns openshift-storage) -WARNING[Oct 19 17:08:22.004][operators.go: 183] Subscription not found for CSV: packageserver (ns openshift-operator-lifecycle-manager) -INFO [Oct 19 17:08:22.004][operators.go: 185] Getting installplans for op packageserver (subs ns ) -INFO [Oct 19 17:08:22.004][provider.go: 566] Node clus0-0 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:22.179][provider.go: 566] Node clus0-1 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -INFO [Oct 19 17:08:22.351][provider.go: 566] Node clus0-2 - mc name: rendered-master-87e86cb409fb5f914d4c94bee99ef373 -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.530][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -DEBUG [Oct 19 17:08:22.531][provider.go: 424] parsed image, repo: quay.io, name:testnetworkfunction/cnf-test-partner, tag: latest, digest: sha256:cca46b755479e1ca7390c9b824ca50057e14375405c2294efb7907d7a0a20c6d -INFO [Oct 19 17:08:22.531][operators.go: 130] Found 0 unique CSVs -INFO [Oct 19 17:08:22.531][provider.go: 299] Operators found: 0 -INFO [Oct 19 17:08:22.531][provider.go: 311] Completed the test environment build process in 6.16 seconds -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-0 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-1 ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-rtxbr ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -DEBUG [Oct 19 17:08:22.531][isolation.go: 71] container: test pod: test-d78fbf8d6-vvlwx ns: tnf has CPU requests 250 (milli) that has to be a whole unit. -INFO [Oct 19 17:08:22.636][archiver.go: 45] Compressing results artifacts into /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/20231019-170822-cnf-test-results.tar.gz -DEBUG [Oct 19 17:08:22.637][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claim.json -DEBUG [Oct 19 17:08:22.666][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/cnf-certification-tests_junit.xml -DEBUG [Oct 19 17:08:22.667][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/claimjson.js -DEBUG [Oct 19 17:08:22.700][archiver.go: 59] Zipping file /Users/amal/Documents/GitHub/cnf-certification-test/cnf-certification-test/results.html diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 782e94368..c47d90fa3 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -22,9 +22,11 @@ import ( "encoding/json" "flag" "fmt" + "io" "net/http" "os" "path/filepath" + "strings" "testing" "time" @@ -363,14 +365,9 @@ var upgrader = websocket.Upgrader{ // Define an HTTP handler that triggers Ginkgo tests func runHandler(w http.ResponseWriter, r *http.Request) { // Run Ginkgo tests - var requestData RequestData //var responseData ResponseData // Parse JSON data from the request body - err := json.NewDecoder(r.Body).Decode(&requestData) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } + // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -394,10 +391,50 @@ func runHandler(w http.ResponseWriter, r *http.Request) { os.Stdout = originalStdout logFile.Close() }() - os.Setenv("KUBECONFIG", requestData.KubeConfigPath) - logrus.Infof("KUBECONFIG : %v", requestData.KubeConfigPath) + logrus.Info(r.FormValue("selectedOptions")) + + jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field + logrus.Info(jsonData) + var data RequstedData + if err := json.Unmarshal([]byte(jsonData), &data); err != nil { + fmt.Println("Error:", err) + } + logrus.Info("Field1:", data.SelectedOptions) + var flattenedOptions []string + flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) + logrus.Info("Field1:", flattenedOptions) + + // Get the file from the request + file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field + if err != nil { + http.Error(w, "Unable to retrieve file from form", http.StatusBadRequest) + return + } + defer file.Close() + + // Create a new file on the server to store the uploaded content + uploadedFile, err := os.Create(handler.Filename) + if err != nil { + http.Error(w, "Unable to create file for writing", http.StatusInternalServerError) + return + } + defer uploadedFile.Close() + + // Copy the uploaded file's content to the new file + _, err = io.Copy(uploadedFile, file) + if err != nil { + http.Error(w, "Unable to copy file", http.StatusInternalServerError) + return + } + + logrus.Infof("Labels filter : %v", flattenedOptions) + + // Copy the uploaded file to the server file - logrus.Infof("Labels filter : %v", requestData.SelectedOptions) + os.Setenv("KUBECONFIG", handler.Filename) + logrus.Infof("KUBECONFIG : %v", handler.Filename) + + logrus.Infof("Labels filter : %v", flattenedOptions) // Set the output of the logger to the log file @@ -483,7 +520,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { reporterConfig.FullTrace = true reporterConfig.JUnitReport = "cnf-certification-tests_junit.xml" // pass it in to RunSpecs - suiteConfig.LabelFilter = requestData.SelectedOptions + suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) continueRun(&t, false, env, claimData, claimRoot) @@ -491,7 +528,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { response := struct { Message string `json:"Message"` }{ - Message: fmt.Sprintf("Sucsses to run %s", requestData.SelectedOptions), + Message: fmt.Sprintf("Sucsses to run %s", strings.Join(flattenedOptions, "")), } // Serialize the response data to JSON jsonResponse, err := json.Marshal(response) @@ -552,10 +589,28 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { } -type RequestData struct { - KubeConfigPath string `json:"kubeConfigPath"` - SelectedOptions string `json:"selectedOptions"` +type RequstedData struct { + SelectedOptions interface{} `json:"selectedOptions"` } type ResponseData struct { Message string `json:"message"` } + +func flattenData(data interface{}, result []string) []string { + switch v := data.(type) { + case string: + result = append(result, v) + case []interface{}: + for _, item := range v { + result = flattenData(item, result) + } + case map[string]interface{}: + for key, item := range v { + if key == "selectedOptions" { + result = flattenData(item, result) + } + result = flattenData(item, result) + } + } + return result +} diff --git a/go.mod b/go.mod index 32d9c88f8..7ed22398d 100644 --- a/go.mod +++ b/go.mod @@ -211,6 +211,7 @@ require ( github.com/fatih/color v1.16.0 github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 + github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e diff --git a/go.sum b/go.sum index f4b2c7deb..272ee988f 100644 --- a/go.sum +++ b/go.sum @@ -314,6 +314,7 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 7e7a0465d..d1c700d11 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -8,16 +8,17 @@ set -x export OUTPUT_LOC="$PWD/cnf-certification-test" usage() { - echo "$0 [-o OUTPUT_LOC] [-l LABEL...]" + echo "$0 [-o OUTPUT_LOC] [-l LABEL...] [-s run from webpage]" echo "Call the script and list the test suites to run" echo " e.g." echo " $0 [ARGS] -l \"access-control,lifecycle\"" echo " will run the access-control and lifecycle suites" echo " $0 [ARGS] -l all will run all the tests" + echo " $0 [ARGS] -s true will run the test from server" echo "" echo "Allowed suites are listed in the README." echo "" - echo "The specs can be listed with $0 -L|--list [-l LABEL...]" + echo "The specs can be listed with $0 -L|--list [-l LABEL...] [-s run from webpage]" } usage_error() { @@ -42,13 +43,22 @@ while [[ $1 == -* ]]; do ;; -o) if (($# > 1)); then - OUTPUT_LOC=$2 + SERVER_RUN=$2 shift else echo >&2 '-o requires an argument' exit 1 fi ;; + -s) + if (($# > 1)); then + SERVER_RUN=$2 + shift + else + echo >&2 '-s requires an argument' + exit 1 + fi + ;; -l | --label) while (("$#" >= 2)) && ! [[ $2 = --* ]] && ! [[ $2 = -* ]]; do LABEL="$LABEL $2" @@ -86,6 +96,7 @@ GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ +-runserver $SERVER_RUN\ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ From 2fd48a12394724f4c087c627db04e17e1dc01319 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:59:11 +0300 Subject: [PATCH 17/28] change folder name --- cnf-certification-test/suite_test.go | 14 +++++++------- .../{amalpro => webserver}/index.html | 0 .../{amalpro => webserver}/logs.js | 0 .../{amalpro => webserver}/submit.js | 0 .../{amalpro => webserver}/toast.js | 0 5 files changed, 7 insertions(+), 7 deletions(-) rename cnf-certification-test/{amalpro => webserver}/index.html (100%) rename cnf-certification-test/{amalpro => webserver}/logs.js (100%) rename cnf-certification-test/{amalpro => webserver}/submit.js (100%) rename cnf-certification-test/{amalpro => webserver}/toast.js (100%) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index c47d90fa3..6fcc1ca57 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -90,16 +90,16 @@ var ( serveRun *bool ) -//go:embed amalpro/index.html +//go:embed webserver/index.html var indexHTML []byte -//go:embed amalpro/submit.js +//go:embed webserver/submit.js var submit []byte -//go:embed amalpro/logs.js +//go:embed webserver/logs.js var logs []byte -//go:embed amalpro/toast.js +//go:embed webserver/toast.js var toast []byte func init() { @@ -127,7 +127,6 @@ func setLogLevel() { func getK8sClientsConfigFileNames() []string { params := configuration.GetTestParameters() - logrus.Info(params) fileNames := []string{} if params.Kubeconfig != "" { fileNames = append(fileNames, params.Kubeconfig) @@ -229,7 +228,6 @@ func TestTest(t *testing.T) { log.Infof("*serveRun : %v", *serveRun) log.Info("starting the server") - go startServer() // Keep the main program running // Diagnostic functions will run when no labels are provided. @@ -270,8 +268,10 @@ func TestTest(t *testing.T) { ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } continueRun(t, diagnosticMode, env, claimData, claimRoot) + } else { + go startServer() + select {} } - select {} } func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { diff --git a/cnf-certification-test/amalpro/index.html b/cnf-certification-test/webserver/index.html similarity index 100% rename from cnf-certification-test/amalpro/index.html rename to cnf-certification-test/webserver/index.html diff --git a/cnf-certification-test/amalpro/logs.js b/cnf-certification-test/webserver/logs.js similarity index 100% rename from cnf-certification-test/amalpro/logs.js rename to cnf-certification-test/webserver/logs.js diff --git a/cnf-certification-test/amalpro/submit.js b/cnf-certification-test/webserver/submit.js similarity index 100% rename from cnf-certification-test/amalpro/submit.js rename to cnf-certification-test/webserver/submit.js diff --git a/cnf-certification-test/amalpro/toast.js b/cnf-certification-test/webserver/toast.js similarity index 100% rename from cnf-certification-test/amalpro/toast.js rename to cnf-certification-test/webserver/toast.js From 78935e5a1bbf0ab1ddbc12abf01e20226cbc4d66 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:00:01 +0300 Subject: [PATCH 18/28] Delete index.html --- cnf-certification-test/index.html | 260 ------------------------------ 1 file changed, 260 deletions(-) delete mode 100644 cnf-certification-test/index.html diff --git a/cnf-certification-test/index.html b/cnf-certification-test/index.html deleted file mode 100644 index f4e096447..000000000 --- a/cnf-certification-test/index.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - Run Function - - - - - - - - - Red Hat logo -

CNF CERTIFICATION TEST WEBPAGE

-
-
-
- - -

Environment Configuration

-
- - - - - -

TNF Configuration

-
- - - - - - - -

Selecet a Test

-
- -
-
- - - -
-
-
-
- -

Click Run Certification Test

- Run Certification Test -

Show Certification Test log

- Show Log - - -
-

Log Output

-

-		X
-    
- - - - - - - © 2022 Red Hat, Inc. - - - \ No newline at end of file From e7e0a8fa60e136ca671f8d72c3e75654ccb7c0b4 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:31:42 +0300 Subject: [PATCH 19/28] added new function and rename names --- cnf-certification-test/suite_test.go | 117 +++++++++------------------ run-cnf-suites.sh | 5 +- 2 files changed, 39 insertions(+), 83 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 6fcc1ca57..911a19b8e 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -64,10 +64,10 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" - serverRun = "runserver" + serverModeFlag = "server-mode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" - defaultServerRun = false + defaultServerMode = "false" ) var ( @@ -87,7 +87,7 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string - serveRun *bool + serverMode *string ) //go:embed webserver/index.html @@ -107,8 +107,8 @@ func init() { "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") - serveRun = flag.Bool(serverRun, defaultServerRun, - "the path for the junit format report") + serverMode = flag.String(serverModeFlag, defaultServerMode, + "run test with webserver") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -203,9 +203,7 @@ func startServer() { panic(err) } } - -// TestTest invokes the CNF Certification Test Suite. -func TestTest(t *testing.T) { +func preRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // When running unit tests, skip the suite if os.Getenv("UNIT_TEST") != "" { t.Skip("Skipping test suite when running unit tests") @@ -225,38 +223,43 @@ func TestTest(t *testing.T) { log.Infof("Claim Format Version: %s", ClaimFormatVersion) log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) - log.Infof("*serveRun : %v", *serveRun) - log.Info("starting the server") + log.Infof("run test with webserver : %v", *serverMode) + // Set clientsholder singleton with the filenames from the env vars. + _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - // Keep the main program running + // Initialize the claim with the start time, tnf version, etc. + claimRoot = claimhelper.CreateClaimRoot() + claimData = claimRoot.Claim + claimData.Configurations = make(map[string]interface{}) + claimData.Nodes = make(map[string]interface{}) + incorporateVersions(claimData) - // Diagnostic functions will run when no labels are provided. - if !*serveRun { + configurations, err := claimhelper.MarshalConfigurations() + if err != nil { + log.Errorf("Configuration node missing because of: %s", err) + t.FailNow() + } + + claimData.Nodes = claimhelper.GenerateNodes() + claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) + return claimData, claimRoot +} + +// TestTest invokes the CNF Certification Test Suite. +func TestTest(t *testing.T) { + + // Keep the main program running + ginkgoConfig, _ := ginkgo.GinkgoConfiguration() + if *serverMode == "false" { + claimData, claimRoot := preRun(t) var diagnosticMode bool + // Diagnostic functions will run when no labels are provided. + if ginkgoConfig.LabelFilter == "" { log.Infof("TNF will run in diagnostic mode so no test case will be launched.") diagnosticMode = true } - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) - - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } - - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - // initialize abort flag testhelper.AbortTrigger = "" @@ -364,10 +367,6 @@ var upgrader = websocket.Upgrader{ // Define an HTTP handler that triggers Ginkgo tests func runHandler(w http.ResponseWriter, r *http.Request) { - // Run Ginkgo tests - //var responseData ResponseData - // Parse JSON data from the request body - // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -391,7 +390,6 @@ func runHandler(w http.ResponseWriter, r *http.Request) { os.Stdout = originalStdout logFile.Close() }() - logrus.Info(r.FormValue("selectedOptions")) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) @@ -399,10 +397,8 @@ func runHandler(w http.ResponseWriter, r *http.Request) { if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } - logrus.Info("Field1:", data.SelectedOptions) var flattenedOptions []string flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) - logrus.Info("Field1:", flattenedOptions) // Get the file from the request file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field @@ -427,8 +423,6 @@ func runHandler(w http.ResponseWriter, r *http.Request) { return } - logrus.Infof("Labels filter : %v", flattenedOptions) - // Copy the uploaded file to the server file os.Setenv("KUBECONFIG", handler.Filename) @@ -470,46 +464,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } */ t := testing.T{} - logrus.Infof(os.Getenv("KUBECONFIG")) - // When running unit tests, skip the suite - if os.Getenv("UNIT_TEST") != "" { - t.Skip("Skipping test suite when running unit tests") - } - - err = configuration.LoadEnvironmentVariables() - if err != nil { - log.Fatalf("could not load the environment variables, error: %v", err) - } - - // Set up logging params for logrus - loghelper.SetLogFormat() - setLogLevel() - - ginkgoConfig, _ := ginkgo.GinkgoConfiguration() - log.Infof("Ginkgo Version : %v", ginkgo.GINKGO_VERSION) - log.Infof("Labels filter : %v", ginkgoConfig.LabelFilter) - // Set clientsholder singleton with the filenames from the env vars. - _ = clientsholder.GetClientsHolder(getK8sClientsConfigFileNames()...) - - // Initialize the claim with the start time, tnf version, etc. - claimRoot := claimhelper.CreateClaimRoot() - claimData := claimRoot.Claim - claimData.Configurations = make(map[string]interface{}) - claimData.Nodes = make(map[string]interface{}) - incorporateVersions(claimData) - - configurations, err := claimhelper.MarshalConfigurations() - if err != nil { - log.Errorf("Configuration node missing because of: %s", err) - t.FailNow() - } - claimData.Nodes = claimhelper.GenerateNodes() - claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) - - // initialize abort flag - testhelper.AbortTrigger = "" - - fmt.Println("This will be written to the log file.") + claimData, claimRoot := preRun(&t) var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index d1c700d11..7be443e4b 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -29,6 +29,7 @@ usage_error() { TIMEOUT=24h0m0s LABEL='' LIST=false +SERVER_RUN=false BASEDIR=$(dirname "$(realpath "$0")") # Parse args beginning with "-". @@ -43,7 +44,7 @@ while [[ $1 == -* ]]; do ;; -o) if (($# > 1)); then - SERVER_RUN=$2 + OUTPUT_LOC=$2 shift else echo >&2 '-o requires an argument' @@ -96,7 +97,7 @@ GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --runserver $SERVER_RUN\ +-server-mode $SERVER_RUN \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ From 1175fd36a43d3d29be219b2a497dd6d098803dbc Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:52:24 +0300 Subject: [PATCH 20/28] add new file for html function --- cnf-certification-test/suite_test.go | 162 ++----------------- cnf-certification-test/webserver_function.go | 145 +++++++++++++++++ 2 files changed, 162 insertions(+), 145 deletions(-) create mode 100644 cnf-certification-test/webserver_function.go diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 911a19b8e..bbf9bed63 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,7 +17,6 @@ package suite import ( - "bufio" _ "embed" "encoding/json" "flag" @@ -30,7 +29,6 @@ import ( "testing" "time" - "github.com/gorilla/websocket" "github.com/onsi/ginkgo/v2" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" @@ -90,18 +88,6 @@ var ( serverMode *string ) -//go:embed webserver/index.html -var indexHTML []byte - -//go:embed webserver/submit.js -var submit []byte - -//go:embed webserver/logs.js -var logs []byte - -//go:embed webserver/toast.js -var toast []byte - func init() { claimPath = flag.String(claimPathFlagKey, defaultClaimPath, "the path where the claimfile will be output") @@ -151,59 +137,7 @@ func getGitVersion() string { return gitDisplayRelease + " ( " + GitCommit + " )" } -func startServer() { - log.Info("inside starting the server") - - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "text/html". - w.Header().Set("Content-Type", "text/html") - // Write the embedded HTML content to the response. - _, err := w.Write(indexHTML) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(submit) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(logs) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { - // Set the content type to "application/javascript". - w.Header().Set("Content-Type", "application/javascript") - // Write the embedded JavaScript content to the response. - _, err := w.Write(toast) - if err != nil { - http.Error(w, "Failed to write response", http.StatusInternalServerError) - } - }) - - http.HandleFunc("/runFunction", runHandler) - // Serve the static HTML file - http.HandleFunc("/logstream", logStreamHandler) - - fmt.Println("Server is running on :8080...") - if err := http.ListenAndServe(":8080", nil); err != nil { - panic(err) - } -} -func preRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { +func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // When running unit tests, skip the suite if os.Getenv("UNIT_TEST") != "" { t.Skip("Skipping test suite when running unit tests") @@ -251,7 +185,7 @@ func TestTest(t *testing.T) { // Keep the main program running ginkgoConfig, _ := ginkgo.GinkgoConfiguration() if *serverMode == "false" { - claimData, claimRoot := preRun(t) + claimData, claimRoot := PreRun(t) var diagnosticMode bool // Diagnostic functions will run when no labels are provided. @@ -270,14 +204,14 @@ func TestTest(t *testing.T) { env = provider.GetTestEnvironment() ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } - continueRun(t, diagnosticMode, env, claimData, claimRoot) + ContinueRun(t, diagnosticMode, env, claimData, claimRoot) } else { - go startServer() + go StartServer() select {} } } -func continueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { +func ContinueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -358,15 +292,20 @@ func incorporateVersions(claimData *claim.Claim) { ClaimFormat: ClaimFormatVersion, } } +func StartServer() { + + HandlereqFunc() -var upgrader = websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { - return true - }, + http.HandleFunc("/runFunction", RunHandler) + + fmt.Println("Server is running on :8080...") + if err := http.ListenAndServe(":8080", nil); err != nil { + panic(err) + } } // Define an HTTP handler that triggers Ginkgo tests -func runHandler(w http.ResponseWriter, r *http.Request) { +func RunHandler(w http.ResponseWriter, r *http.Request) { // Create or open a log file filename := "log.log" if _, err := os.Stat(filename); err == nil { @@ -464,7 +403,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } */ t := testing.T{} - claimData, claimRoot := preRun(&t) + claimData, claimRoot := PreRun(&t) var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() @@ -478,7 +417,7 @@ func runHandler(w http.ResponseWriter, r *http.Request) { suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) - continueRun(&t, false, env, claimData, claimRoot) + ContinueRun(&t, false, env, claimData, claimRoot) // Return the result as JSON response := struct { Message string `json:"Message"` @@ -502,70 +441,3 @@ func runHandler(w http.ResponseWriter, r *http.Request) { } } - -func logStreamHandler(w http.ResponseWriter, r *http.Request) { - conn, err := upgrader.Upgrade(w, r, nil) - if err != nil { - log.Printf("WebSocket upgrade error: %v", err) - return - } - defer conn.Close() - - filePath := "log.log" - - // Open the log file - file, err := os.Open(filePath) - if err != nil { - log.Println(err) - return - } - defer file.Close() - - // Create a scanner to read the log file line by line - for { - scanner := bufio.NewScanner(file) - for scanner.Scan() { - line := scanner.Text() + "\n" - // Send each log line to the client - if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { - fmt.Println(err) - //return - } - - // Sleep for a short duration to simulate real-time updates - time.Sleep(100 * time.Millisecond) - } - if err := scanner.Err(); err != nil { - log.Printf("Error reading log file: %v", err) - } - - time.Sleep(1 * time.Second) - } - -} - -type RequstedData struct { - SelectedOptions interface{} `json:"selectedOptions"` -} -type ResponseData struct { - Message string `json:"message"` -} - -func flattenData(data interface{}, result []string) []string { - switch v := data.(type) { - case string: - result = append(result, v) - case []interface{}: - for _, item := range v { - result = flattenData(item, result) - } - case map[string]interface{}: - for key, item := range v { - if key == "selectedOptions" { - result = flattenData(item, result) - } - result = flattenData(item, result) - } - } - return result -} diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go new file mode 100644 index 000000000..30bb3e787 --- /dev/null +++ b/cnf-certification-test/webserver_function.go @@ -0,0 +1,145 @@ +package suite + +import ( + "bufio" + _ "embed" + "fmt" + "net/http" + "os" + "time" + + "github.com/gorilla/websocket" + + "github.com/sirupsen/logrus" +) + +//go:embed webserver/index.html +var indexHTML []byte + +//go:embed webserver/submit.js +var submit []byte + +//go:embed webserver/logs.js +var logs []byte + +//go:embed webserver/toast.js +var toast []byte + +var upgrader = websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, +} + +func logStreamHandler(w http.ResponseWriter, r *http.Request) { + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + logrus.Printf("WebSocket upgrade error: %v", err) + return + } + defer conn.Close() + + filePath := "log.log" + + // Open the log file + file, err := os.Open(filePath) + if err != nil { + logrus.Println(err) + return + } + defer file.Close() + + // Create a scanner to read the log file line by line + for { + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + "\n" + // Send each log line to the client + if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + fmt.Println(err) + //return + } + + // Sleep for a short duration to simulate real-time updates + time.Sleep(100 * time.Millisecond) + } + if err := scanner.Err(); err != nil { + logrus.Printf("Error reading log file: %v", err) + } + + time.Sleep(1 * time.Second) + } + +} + +type RequstedData struct { + SelectedOptions interface{} `json:"selectedOptions"` +} +type ResponseData struct { + Message string `json:"message"` +} + +func flattenData(data interface{}, result []string) []string { + switch v := data.(type) { + case string: + result = append(result, v) + case []interface{}: + for _, item := range v { + result = flattenData(item, result) + } + case map[string]interface{}: + for key, item := range v { + if key == "selectedOptions" { + result = flattenData(item, result) + } + result = flattenData(item, result) + } + } + return result +} +func HandlereqFunc() { + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "text/html". + w.Header().Set("Content-Type", "text/html") + // Write the embedded HTML content to the response. + _, err := w.Write(indexHTML) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/submit.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(submit) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/logs.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(logs) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + http.HandleFunc("/toast.js", func(w http.ResponseWriter, r *http.Request) { + // Set the content type to "application/javascript". + w.Header().Set("Content-Type", "application/javascript") + // Write the embedded JavaScript content to the response. + _, err := w.Write(toast) + if err != nil { + http.Error(w, "Failed to write response", http.StatusInternalServerError) + } + }) + + // Serve the static HTML file + http.HandleFunc("/logstream", logStreamHandler) + +} From e85767a23f30819dfd728644493069f2b7c08196 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:29:28 +0200 Subject: [PATCH 21/28] fix for saving the log to be in a bif and not in a file --- cnf-certification-test/suite_test.go | 33 +++++--------------- cnf-certification-test/webserver/index.html | 5 +-- cnf-certification-test/webserver/logs.js | 2 +- cnf-certification-test/webserver_function.go | 24 ++++---------- 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index bbf9bed63..12a7b4bd9 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -17,6 +17,7 @@ package suite import ( + "bytes" _ "embed" "encoding/json" "flag" @@ -298,37 +299,18 @@ func StartServer() { http.HandleFunc("/runFunction", RunHandler) - fmt.Println("Server is running on :8080...") - if err := http.ListenAndServe(":8080", nil); err != nil { + fmt.Println("Server is running on :8084...") + if err := http.ListenAndServe(":8084", nil); err != nil { panic(err) } } // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - // Create or open a log file - filename := "log.log" - if _, err := os.Stat(filename); err == nil { - // If it exists, truncate it to remove the contents - file, err := os.OpenFile(filename, os.O_TRUNC, 0) - if err != nil { - // Handle the error if necessary - panic(err) - } - file.Close() - } - logFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) - if err != nil { - panic(err) - } - logrus.SetOutput(logFile) - originalStdout := os.Stdout - os.Stdout = logFile - // Read the YAML file - defer func() { - os.Stdout = originalStdout - logFile.Close() - }() + + Buf = bytes.NewBufferString(aString) + + logrus.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) @@ -407,6 +389,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { var env provider.TestEnvironment env.SetNeedsRefresh() env = provider.GetTestEnvironment() + // fetch the current config suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration() // adjust it diff --git a/cnf-certification-test/webserver/index.html b/cnf-certification-test/webserver/index.html index dbac2fdbb..07611612a 100644 --- a/cnf-certification-test/webserver/index.html +++ b/cnf-certification-test/webserver/index.html @@ -138,10 +138,6 @@ await toast({ heading, message, state, timeout: 20_000 }); }); document.getElementById('show-logs').addEventListener('click', async function(event) { - const code = document - .getElementById('logs') - .querySelector('rh-code-block'); - code.textContent = ''; await import('./logs.js') }); @@ -166,6 +162,7 @@

CNF Certification Test

diff --git a/cnf-certification-test/webserver/logs.js b/cnf-certification-test/webserver/logs.js index a3624f210..4de5b4968 100644 --- a/cnf-certification-test/webserver/logs.js +++ b/cnf-certification-test/webserver/logs.js @@ -1,6 +1,6 @@ import '@rhds/elements/rh-code-block/rh-code-block.js'; -const socket = new WebSocket('ws://localhost:8080/logstream'); +const socket = new WebSocket('ws://localhost:8084/logstream'); const code = document .getElementById('logs') .querySelector('rh-code-block'); diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 30bb3e787..5cbeac9f0 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -2,11 +2,10 @@ package suite import ( "bufio" + "bytes" _ "embed" "fmt" "net/http" - "os" - "time" "github.com/gorilla/websocket" @@ -24,6 +23,8 @@ var logs []byte //go:embed webserver/toast.js var toast []byte +var Buf *bytes.Buffer +var aString string var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { @@ -38,36 +39,23 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { return } defer conn.Close() - - filePath := "log.log" - - // Open the log file - file, err := os.Open(filePath) - if err != nil { - logrus.Println(err) - return - } - defer file.Close() - // Create a scanner to read the log file line by line for { - scanner := bufio.NewScanner(file) + scanner := bufio.NewScanner(Buf) for scanner.Scan() { line := scanner.Text() + "\n" // Send each log line to the client if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { fmt.Println(err) - //return + return } - // Sleep for a short duration to simulate real-time updates - time.Sleep(100 * time.Millisecond) } if err := scanner.Err(); err != nil { logrus.Printf("Error reading log file: %v", err) + return } - time.Sleep(1 * time.Second) } } From 9827cefdb6ca01004e97ced4008667959de6bc54 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:15:05 +0200 Subject: [PATCH 22/28] add bufer implemntation fir logs --- cnf-certification-test/suite_test.go | 3 ++- cnf-certification-test/webserver/logs.js | 2 +- cnf-certification-test/webserver_function.go | 8 ++++--- go.mod | 2 ++ go.sum | 23 ++++++++++++++++++++ 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 12a7b4bd9..47949fc25 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -23,6 +23,7 @@ import ( "flag" "fmt" "io" + logl "log" "net/http" "os" "path/filepath" @@ -311,7 +312,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { Buf = bytes.NewBufferString(aString) logrus.SetOutput(Buf) - + logl.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field logrus.Info(jsonData) var data RequstedData diff --git a/cnf-certification-test/webserver/logs.js b/cnf-certification-test/webserver/logs.js index 4de5b4968..81b3f4c05 100644 --- a/cnf-certification-test/webserver/logs.js +++ b/cnf-certification-test/webserver/logs.js @@ -7,5 +7,5 @@ const code = document code.textContent = ''; // Handle incoming log messages socket.addEventListener('message', function (event) { - code.textContent += event.data + '\n'; + code.innerHTML += event.data + '\n'; }); \ No newline at end of file diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 5cbeac9f0..1d9975ec7 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -8,7 +8,7 @@ import ( "net/http" "github.com/gorilla/websocket" - + "github.com/robert-nix/ansihtml" "github.com/sirupsen/logrus" ) @@ -43,9 +43,11 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { for { scanner := bufio.NewScanner(Buf) for scanner.Scan() { - line := scanner.Text() + "\n" + line := scanner.Bytes() + line = append(ansihtml.ConvertToHTML(line), []byte("
")...) + // Send each log line to the client - if err := conn.WriteMessage(websocket.TextMessage, []byte(line)); err != nil { + if err := conn.WriteMessage(websocket.TextMessage, line); err != nil { fmt.Println(err) return } diff --git a/go.mod b/go.mod index 7ed22398d..c9014ca42 100644 --- a/go.mod +++ b/go.mod @@ -214,10 +214,12 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 + github.com/onsi/ginkgo v1.16.5 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e github.com/redhat-openshift-ecosystem/openshift-preflight v0.0.0-20231018165107-f04b78186455 github.com/test-network-function/oct v0.0.3 github.com/test-network-function/privileged-daemonset v1.0.14 + github.com/robert-nix/ansihtml v1.0.1 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 k8s.io/kubectl v0.28.3 diff --git a/go.sum b/go.sum index 272ee988f..5842ef9d8 100644 --- a/go.sum +++ b/go.sum @@ -179,6 +179,8 @@ github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6 github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -213,6 +215,7 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= @@ -335,6 +338,7 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -452,12 +456,17 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -518,6 +527,9 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/robert-nix/ansihtml v1.0.1 h1:VTiyQ6/+AxSJoSSLsMecnkh8i0ZqOEdiRl/odOc64fc= +github.com/robert-nix/ansihtml v1.0.1/go.mod h1:CJwclxYaTPc2RfcxtanEACsYuTksh4yDXcNeHHKZINE= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= @@ -685,6 +697,7 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -707,6 +720,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -747,6 +761,7 @@ golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -758,7 +773,10 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -779,6 +797,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -863,6 +882,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -985,6 +1005,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -993,6 +1014,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From 7ce8b09c9cef1ca83e0d2a18e55c96637c492fca Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:18:11 +0200 Subject: [PATCH 23/28] update the flag --- cnf-certification-test/suite_test.go | 11 +++++------ run-cnf-suites.sh | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 47949fc25..3eba1c2e6 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -32,7 +32,6 @@ import ( "time" "github.com/onsi/ginkgo/v2" - "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" "github.com/test-network-function/cnf-certification-test/cnf-certification-test/results" "github.com/test-network-function/cnf-certification-test/pkg/claimhelper" @@ -64,7 +63,7 @@ const ( defaultClaimPath = ".." defaultCliArgValue = "" junitFlagKey = "junit" - serverModeFlag = "server-mode" + serverModeFlag = "serverMode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" defaultServerMode = "false" @@ -311,10 +310,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { Buf = bytes.NewBufferString(aString) - logrus.SetOutput(Buf) + log.SetOutput(Buf) logl.SetOutput(Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field - logrus.Info(jsonData) + log.Info(jsonData) var data RequstedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) @@ -348,9 +347,9 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { // Copy the uploaded file to the server file os.Setenv("KUBECONFIG", handler.Filename) - logrus.Infof("KUBECONFIG : %v", handler.Filename) + log.Infof("KUBECONFIG : %v", handler.Filename) - logrus.Infof("Labels filter : %v", flattenedOptions) + log.Infof("Labels filter : %v", flattenedOptions) // Set the output of the logger to the log file diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 7be443e4b..197a51c84 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -95,9 +95,9 @@ fi # Specify Junit report file name. GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ +-serverMode $SERVER_RUN \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --server-mode $SERVER_RUN \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ -ginkgo.v \ -test.v\ @@ -112,7 +112,7 @@ echo "Report will be output to '$OUTPUT_LOC'" echo "ginkgo arguments '${GINKGO_ARGS}'" LABEL_STRING='' -if [ -z "$LABEL" ]; then +if [ -z "$LABEL" ] && ([ -z "$SERVER_RUN" ] || [ $SERVER_RUN == false ]); then echo "No test label (-l) was set, so only diagnostic functions will run." else LABEL_STRING="-ginkgo.label-filter=${LABEL}" From f6fcba63ea8aa05a8b326b8057ca5e690a133703 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:39:15 +0200 Subject: [PATCH 24/28] few changes for linter --- cnf-certification-test/suite_test.go | 58 ++++---------------- cnf-certification-test/webserver_function.go | 10 ++-- go.mod | 1 - go.sum | 21 ------- 4 files changed, 15 insertions(+), 75 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 3eba1c2e6..5b94a6a45 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -174,7 +174,6 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { log.Errorf("Configuration node missing because of: %s", err) t.FailNow() } - claimData.Nodes = claimhelper.GenerateNodes() claimhelper.UnmarshalConfigurations(configurations, claimData.Configurations) return claimData, claimRoot @@ -182,8 +181,6 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { - - // Keep the main program running ginkgoConfig, _ := ginkgo.GinkgoConfiguration() if *serverMode == "false" { claimData, claimRoot := PreRun(t) @@ -205,15 +202,14 @@ func TestTest(t *testing.T) { env = provider.GetTestEnvironment() ginkgo.RunSpecs(t, CnfCertificationTestSuiteName) } - ContinueRun(t, diagnosticMode, env, claimData, claimRoot) + ContinueRun(diagnosticMode, &env, claimData, claimRoot) } else { go StartServer() select {} } } -func ContinueRun(t *testing.T, diagnosticMode bool, env provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { - +func ContinueRun(diagnosticMode bool, env *provider.TestEnvironment, claimData *claim.Claim, claimRoot *claim.Root) { endTime := time.Now() claimData.Metadata.EndTime = endTime.UTC().Format(claimhelper.DateTimeFormatDirective) @@ -294,24 +290,28 @@ func incorporateVersions(claimData *claim.Claim) { } } func StartServer() { - + server := &http.Server{ + Addr: ":8084", // Server address + ReadTimeout: 10 * time.Second, // Maximum duration for reading the entire request + WriteTimeout: 10 * time.Second, // Maximum duration for writing the entire response + IdleTimeout: 120 * time.Second, // Maximum idle duration before closing the connection + } HandlereqFunc() http.HandleFunc("/runFunction", RunHandler) fmt.Println("Server is running on :8084...") - if err := http.ListenAndServe(":8084", nil); err != nil { + if err := server.ListenAndServe(); err != nil { panic(err) } } // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - Buf = bytes.NewBufferString(aString) - log.SetOutput(Buf) logl.SetOutput(Buf) + jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) var data RequstedData @@ -350,40 +350,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { log.Infof("KUBECONFIG : %v", handler.Filename) log.Infof("Labels filter : %v", flattenedOptions) - - // Set the output of the logger to the log file - - /*data, err := os.ReadFile("tnf_config.yml") - if err != nil { - log.Fatalf("Error reading YAML file: %v", err) - } - - // Unmarshal the YAML data into a Config struct - var config configuration.TestConfiguration - - err = yaml.Unmarshal(data, &config) - if err != nil { - log.Fatalf("Error unmarshaling YAML: %v", err) - } - - // Modify the configuration - var namespace []configuration.Namespace - namespace = append(namespace, configuration.Namespace{Name: requestData.Field3}) - - config.TargetNameSpaces = namespace // Change the port to a new value - - // Serialize the modified config back to YAML format - newData, err := yaml.Marshal(&config) - if err != nil { - log.Fatalf("Error marshaling YAML: %v", err) - } - - // Write the modified YAML data back to the file - err = os.WriteFile("tnf_config.yml", newData, os.ModePerm) - if err != nil { - log.Fatalf("Error writing YAML file: %v", err) - } - */ t := testing.T{} claimData, claimRoot := PreRun(&t) var env provider.TestEnvironment @@ -400,7 +366,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { suiteConfig.LabelFilter = strings.Join(flattenedOptions, "") ginkgo.RunSpecs(&t, CnfCertificationTestSuiteName, suiteConfig, reporterConfig) - ContinueRun(&t, false, env, claimData, claimRoot) + ContinueRun(false, &env, claimData, claimRoot) // Return the result as JSON response := struct { Message string `json:"Message"` @@ -415,12 +381,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { } // Set the Content-Type header to specify that the response is JSON w.Header().Set("Content-Type", "application/json") - // Write the JSON response to the client _, err = w.Write(jsonResponse) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - } diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index 1d9975ec7..cbc942081 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -51,15 +51,12 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { fmt.Println(err) return } - } if err := scanner.Err(); err != nil { logrus.Printf("Error reading log file: %v", err) return } - } - } type RequstedData struct { @@ -88,7 +85,6 @@ func flattenData(data interface{}, result []string) []string { return result } func HandlereqFunc() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Set the content type to "text/html". w.Header().Set("Content-Type", "text/html") @@ -96,6 +92,7 @@ func HandlereqFunc() { _, err := w.Write(indexHTML) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -106,6 +103,7 @@ func HandlereqFunc() { _, err := w.Write(submit) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -116,6 +114,7 @@ func HandlereqFunc() { _, err := w.Write(logs) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) @@ -126,10 +125,9 @@ func HandlereqFunc() { _, err := w.Write(toast) if err != nil { http.Error(w, "Failed to write response", http.StatusInternalServerError) + return } }) - // Serve the static HTML file http.HandleFunc("/logstream", logStreamHandler) - } diff --git a/go.mod b/go.mod index c9014ca42..73e581748 100644 --- a/go.mod +++ b/go.mod @@ -214,7 +214,6 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 github.com/manifoldco/promptui v0.9.0 - github.com/onsi/ginkgo v1.16.5 github.com/openshift/machine-config-operator v0.0.1-0.20230515070935-49f32d46538e github.com/redhat-openshift-ecosystem/openshift-preflight v0.0.0-20231018165107-f04b78186455 github.com/test-network-function/oct v0.0.3 diff --git a/go.sum b/go.sum index 5842ef9d8..43965e69d 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,6 @@ github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6 github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -215,7 +213,6 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= @@ -338,7 +335,6 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -456,17 +452,12 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -529,7 +520,6 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/robert-nix/ansihtml v1.0.1 h1:VTiyQ6/+AxSJoSSLsMecnkh8i0ZqOEdiRl/odOc64fc= github.com/robert-nix/ansihtml v1.0.1/go.mod h1:CJwclxYaTPc2RfcxtanEACsYuTksh4yDXcNeHHKZINE= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= @@ -697,7 +687,6 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -720,7 +709,6 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -761,7 +749,6 @@ golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -773,10 +760,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -797,7 +781,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -882,7 +865,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1005,7 +987,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -1014,8 +995,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From 2bcec7d2d000a2533cf85113ca001a0ae260a711 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:48:56 +0200 Subject: [PATCH 25/28] Update run-cnf-suites.sh --- run-cnf-suites.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 197a51c84..e533eae2b 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -112,7 +112,7 @@ echo "Report will be output to '$OUTPUT_LOC'" echo "ginkgo arguments '${GINKGO_ARGS}'" LABEL_STRING='' -if [ -z "$LABEL" ] && ([ -z "$SERVER_RUN" ] || [ $SERVER_RUN == false ]); then +if [ -z "$LABEL" ] && { [ -z "$SERVER_RUN" ] || [ "$SERVER_RUN" == "false" ]; }; then echo "No test label (-l) was set, so only diagnostic functions will run." else LABEL_STRING="-ginkgo.label-filter=${LABEL}" From f10d536d244100ea4a0b172aa7417e177d5f6101 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:53:48 +0200 Subject: [PATCH 26/28] udpate typos --- cnf-certification-test/suite_test.go | 2 +- cnf-certification-test/webserver_function.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 5b94a6a45..f543f2ef7 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -314,7 +314,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) - var data RequstedData + var data RequestedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver_function.go index cbc942081..d804a2938 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver_function.go @@ -59,7 +59,7 @@ func logStreamHandler(w http.ResponseWriter, r *http.Request) { } } -type RequstedData struct { +type RequestedData struct { SelectedOptions interface{} `json:"selectedOptions"` } type ResponseData struct { From ab9c71d6f82efc51f990021037b2bd7b0302fa6d Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:34:28 +0200 Subject: [PATCH 27/28] david comments --- cnf-certification-test/suite_test.go | 15 ++++++++------- .../{ => webserver}/webserver_function.go | 19 +++++++++---------- run-cnf-suites.sh | 8 +------- 3 files changed, 18 insertions(+), 24 deletions(-) rename cnf-certification-test/{ => webserver}/webserver_function.go (90%) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index f543f2ef7..7f1b1a12a 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -23,7 +23,7 @@ import ( "flag" "fmt" "io" - logl "log" + rlog "log" "net/http" "os" "path/filepath" @@ -52,6 +52,7 @@ import ( _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/performance" _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/platform" _ "github.com/test-network-function/cnf-certification-test/cnf-certification-test/preflight" + "github.com/test-network-function/cnf-certification-test/cnf-certification-test/webserver" "github.com/test-network-function/cnf-certification-test/internal/clientsholder" "github.com/test-network-function/cnf-certification-test/pkg/configuration" "github.com/test-network-function/cnf-certification-test/pkg/diagnostics" @@ -296,7 +297,7 @@ func StartServer() { WriteTimeout: 10 * time.Second, // Maximum duration for writing the entire response IdleTimeout: 120 * time.Second, // Maximum idle duration before closing the connection } - HandlereqFunc() + webserver.HandlereqFunc() http.HandleFunc("/runFunction", RunHandler) @@ -308,18 +309,18 @@ func StartServer() { // Define an HTTP handler that triggers Ginkgo tests func RunHandler(w http.ResponseWriter, r *http.Request) { - Buf = bytes.NewBufferString(aString) - log.SetOutput(Buf) - logl.SetOutput(Buf) + webserver.Buf = bytes.NewBufferString("") + log.SetOutput(webserver.Buf) + rlog.SetOutput(webserver.Buf) jsonData := r.FormValue("jsonData") // "jsonData" is the name of the JSON input field log.Info(jsonData) - var data RequestedData + var data webserver.RequestedData if err := json.Unmarshal([]byte(jsonData), &data); err != nil { fmt.Println("Error:", err) } var flattenedOptions []string - flattenedOptions = flattenData(data.SelectedOptions, flattenedOptions) + flattenedOptions = webserver.FlattenData(data.SelectedOptions, flattenedOptions) // Get the file from the request file, handler, err := r.FormFile("kubeConfigPath") // "fileInput" is the name of the file input field diff --git a/cnf-certification-test/webserver_function.go b/cnf-certification-test/webserver/webserver_function.go similarity index 90% rename from cnf-certification-test/webserver_function.go rename to cnf-certification-test/webserver/webserver_function.go index d804a2938..1069432f6 100644 --- a/cnf-certification-test/webserver_function.go +++ b/cnf-certification-test/webserver/webserver_function.go @@ -1,4 +1,4 @@ -package suite +package webserver import ( "bufio" @@ -12,19 +12,18 @@ import ( "github.com/sirupsen/logrus" ) -//go:embed webserver/index.html +//go:embed index.html var indexHTML []byte -//go:embed webserver/submit.js +//go:embed submit.js var submit []byte -//go:embed webserver/logs.js +//go:embed logs.js var logs []byte -//go:embed webserver/toast.js +//go:embed toast.js var toast []byte var Buf *bytes.Buffer -var aString string var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { @@ -66,20 +65,20 @@ type ResponseData struct { Message string `json:"message"` } -func flattenData(data interface{}, result []string) []string { +func FlattenData(data interface{}, result []string) []string { switch v := data.(type) { case string: result = append(result, v) case []interface{}: for _, item := range v { - result = flattenData(item, result) + result = FlattenData(item, result) } case map[string]interface{}: for key, item := range v { if key == "selectedOptions" { - result = flattenData(item, result) + result = FlattenData(item, result) } - result = flattenData(item, result) + result = FlattenData(item, result) } } return result diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index e533eae2b..17e48283e 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -52,13 +52,7 @@ while [[ $1 == -* ]]; do fi ;; -s) - if (($# > 1)); then - SERVER_RUN=$2 - shift - else - echo >&2 '-s requires an argument' - exit 1 - fi + SERVER_RUN=true ;; -l | --label) while (("$#" >= 2)) && ! [[ $2 = --* ]] && ! [[ $2 = -* ]]; do From 93a323874ab2af1ef25464abdb7d4fdc1c5c0216 Mon Sep 17 00:00:00 2001 From: aabughosh <88486034+aabughosh@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:14:09 +0200 Subject: [PATCH 28/28] update the flag --- cnf-certification-test/suite_test.go | 9 ++++----- run-cnf-suites.sh | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cnf-certification-test/suite_test.go b/cnf-certification-test/suite_test.go index 7f1b1a12a..60b2325c4 100644 --- a/cnf-certification-test/suite_test.go +++ b/cnf-certification-test/suite_test.go @@ -67,7 +67,7 @@ const ( serverModeFlag = "serverMode" TNFReportKey = "cnf-certification-test" extraInfoKey = "testsExtraInfo" - defaultServerMode = "false" + defaultServerMode = false ) var ( @@ -87,7 +87,7 @@ var ( // ClaimFormat is the current version for the claim file format to be produced by the TNF test suite. // A client decoding this claim file must support decoding its specific version. ClaimFormatVersion string - serverMode *string + serverMode *bool ) func init() { @@ -95,8 +95,7 @@ func init() { "the path where the claimfile will be output") junitPath = flag.String(junitFlagKey, defaultCliArgValue, "the path for the junit format report") - serverMode = flag.String(serverModeFlag, defaultServerMode, - "run test with webserver") + serverMode = flag.Bool("serverMode", defaultServerMode, "run test with webserver") } // setLogLevel sets the log level for logrus based on the "TNF_LOG_LEVEL" environment variable @@ -183,7 +182,7 @@ func PreRun(t *testing.T) (claimData *claim.Claim, claimRoot *claim.Root) { // TestTest invokes the CNF Certification Test Suite. func TestTest(t *testing.T) { ginkgoConfig, _ := ginkgo.GinkgoConfiguration() - if *serverMode == "false" { + if !*serverMode { claimData, claimRoot := PreRun(t) var diagnosticMode bool // Diagnostic functions will run when no labels are provided. diff --git a/run-cnf-suites.sh b/run-cnf-suites.sh index 17e48283e..625be8052 100755 --- a/run-cnf-suites.sh +++ b/run-cnf-suites.sh @@ -89,7 +89,6 @@ fi # Specify Junit report file name. GINKGO_ARGS="\ --ginkgo.timeout=$TIMEOUT \ --serverMode $SERVER_RUN \ -junit $OUTPUT_LOC \ -claimloc $OUTPUT_LOC \ --ginkgo.junit-report $OUTPUT_LOC/cnf-certification-tests_junit.xml \ @@ -97,6 +96,10 @@ GINKGO_ARGS="\ -test.v\ " +if [ "$SERVER_RUN" = "true" ]; then + GINKGO_ARGS="$GINKGO_ARGS -serverMode" +fi + if [[ $LABEL == "all" ]]; then LABEL='common,extended,faredge,telco' fi