From 05ff4a527d147090a584183c273f666657bdab89 Mon Sep 17 00:00:00 2001
From: Florian Ruynat <16313165+floryut@users.noreply.github.com>
Date: Thu, 10 Sep 2020 12:45:54 +0200
Subject: [PATCH] Fix a bunch of failed quality rules (#6646)

---
 tests/cloud_playbooks/upload-logs-gcs.yml  |  1 +
 tests/testcases/015_check-nodes-ready.yml  |  8 ++++----
 tests/testcases/020_check-pods-running.yml | 12 ++++++------
 tests/testcases/030_check-network.yml      | 21 +++++++++++----------
 4 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/tests/cloud_playbooks/upload-logs-gcs.yml b/tests/cloud_playbooks/upload-logs-gcs.yml
index 5ebb6f578..679f80558 100644
--- a/tests/cloud_playbooks/upload-logs-gcs.yml
+++ b/tests/cloud_playbooks/upload-logs-gcs.yml
@@ -55,6 +55,7 @@
 
     - name: Apply the lifecycle rules  # noqa 301
       command: "{{ dir }}/google-cloud-sdk/bin/gsutil lifecycle set {{ dir }}/gcs_life.json gs://{{ test_name }}"
+      changed_when: false
       environment:
         BOTO_CONFIG: "{{ dir }}/.boto"
       no_log: True
diff --git a/tests/testcases/015_check-nodes-ready.yml b/tests/testcases/015_check-nodes-ready.yml
index e233d5e03..b5bf60938 100644
--- a/tests/testcases/015_check-nodes-ready.yml
+++ b/tests/testcases/015_check-nodes-ready.yml
@@ -15,8 +15,8 @@
   - import_role:
       name: cluster-dump
 
-  - name: Check kubectl output  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get nodes"
+  - name: Check kubectl output
+    command: "{{ bin_dir }}/kubectl get nodes"
     changed_when: false
     register: get_nodes
     no_log: true
@@ -24,8 +24,8 @@
   - debug:
       msg: "{{ get_nodes.stdout.split('\n') }}"
 
-  - name: Check that all nodes are running and ready  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get nodes --no-headers -o yaml"
+  - name: Check that all nodes are running and ready
+    command: "{{ bin_dir }}/kubectl get nodes --no-headers -o yaml"
     changed_when: false
     register: get_nodes_yaml
     until:
diff --git a/tests/testcases/020_check-pods-running.yml b/tests/testcases/020_check-pods-running.yml
index 504219dc4..6af07b137 100644
--- a/tests/testcases/020_check-pods-running.yml
+++ b/tests/testcases/020_check-pods-running.yml
@@ -15,8 +15,8 @@
   - import_role:
       name: cluster-dump
 
-  - name: Check kubectl output  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
+  - name: Check kubectl output
+    command: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
     changed_when: false
     register: get_pods
     no_log: true
@@ -24,8 +24,8 @@
   - debug:
       msg: "{{ get_pods.stdout.split('\n') }}"
 
-  - name: Check that all pods are running and ready  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods --all-namespaces --no-headers -o yaml"
+  - name: Check that all pods are running and ready
+    command: "{{ bin_dir }}/kubectl get pods --all-namespaces --no-headers -o yaml"
     changed_when: false
     register: run_pods_log
     until:
@@ -38,8 +38,8 @@
     failed_when: false
     no_log: true
 
-  - name: Check kubectl output  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
+  - name: Check kubectl output
+    command: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
     changed_when: false
     register: get_pods
     no_log: true
diff --git a/tests/testcases/030_check-network.yml b/tests/testcases/030_check-network.yml
index c0ca036d8..135d56130 100644
--- a/tests/testcases/030_check-network.yml
+++ b/tests/testcases/030_check-network.yml
@@ -39,11 +39,12 @@
 
     when: kubelet_rotate_server_certificates | default(false)
 
-  - name: Create test namespace  # noqa 301 305
-    shell: "{{ bin_dir }}/kubectl create namespace test"
+  - name: Create test namespace
+    command: "{{ bin_dir }}/kubectl create namespace test"
+    changed_when: false
 
-  - name: Run 2 busybox pods in test ns  # noqa 305
-    shell: "{{ bin_dir }}/kubectl run {{ item }} --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --command -- tail -f /dev/null"
+  - name: Run 2 busybox pods in test ns
+    command: "{{ bin_dir }}/kubectl run {{ item }} --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --command -- tail -f /dev/null"
     changed_when: false
     loop:
     - busybox1
@@ -52,8 +53,8 @@
   - import_role:
       name: cluster-dump
 
-  - name: Check that all pods are running and ready  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods --namespace test --no-headers -o yaml"
+  - name: Check that all pods are running and ready
+    command: "{{ bin_dir }}/kubectl get pods --namespace test --no-headers -o yaml"
     changed_when: false
     register: run_pods_log
     until:
@@ -66,8 +67,8 @@
     failed_when: false
     no_log: true
 
-  - name: Get pod names  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods -n test -o json"
+  - name: Get pod names
+    command: "{{ bin_dir }}/kubectl get pods -n test -o json"
     changed_when: false
     register: pods
     no_log: true
@@ -90,8 +91,8 @@
     register: running_pods
     no_log: true
 
-  - name: Check kubectl output  # noqa 305
-    shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
+  - name: Check kubectl output
+    command: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
     changed_when: False
     register: get_pods
     no_log: true
-- 
GitLab