From b7e85d528292589831c2380ba3f5ed2bd8e98c75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= <radoslaw.piliszek@gmail.com>
Date: Fri, 24 Apr 2020 16:14:42 +0200
Subject: [PATCH] [CI] Test Swift upgrades

Swift is a major OpenStack project. It could use testing upgrades.

New jobs are placed in the experimental pipeline to avoid
excessive CI load on general changes.

Change-Id: I8a089fdd1f21eb4c3e00c38ea9dfcecc77565bf5
Related-Bug: #1874691
---
 tests/run.yml       |  6 ++++++
 tests/test-swift.sh |  8 ++++++++
 zuul.d/jobs.yaml    | 20 ++++++++++++++++++++
 zuul.d/project.yaml |  4 ++++
 4 files changed, 38 insertions(+)

diff --git a/tests/run.yml b/tests/run.yml
index 7f3c953291..b365b3c41d 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -591,6 +591,12 @@
             HAS_UPGRADE: 'yes'
             PHASE: upgrade
           when: openstack_core_tested
+
+        - name: Run test-swift.sh script
+          command:
+            cmd: tests/test-swift.sh
+            chdir: "{{ kolla_ansible_src_dir }}"
+          when: scenario == 'swift'
       when: is_upgrade
 
     # Bifrost testing.
diff --git a/tests/test-swift.sh b/tests/test-swift.sh
index 0436dcb3b6..b9cadc3680 100755
--- a/tests/test-swift.sh
+++ b/tests/test-swift.sh
@@ -40,9 +40,17 @@ function test_swift_logged {
 
     openstack --debug object store account show
 
+    cleanup_swift
+
     echo "SUCCESS: Swift"
 }
 
+function cleanup_swift {
+    openstack --debug object delete $CONTAINER_NAME $FILE_PATH
+
+    openstack --debug container delete $CONTAINER_NAME
+}
+
 function test_swift {
     echo "Testing Swift"
     log_file=/tmp/logs/ansible/test-swift
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 1f39116642..552b3e5ae9 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -225,6 +225,26 @@
       base_distro: ubuntu
       install_type: source
 
+- job:
+    name: kolla-ansible-centos8s-source-swift-upgrade
+    parent: kolla-ansible-swift-base
+    nodeset: kolla-ansible-centos8s-multi
+    timeout: 10800
+    vars:
+      base_distro: centos
+      install_type: source
+      is_upgrade: yes
+
+- job:
+    name: kolla-ansible-ubuntu-source-swift-upgrade
+    parent: kolla-ansible-swift-base
+    nodeset: kolla-ansible-focal-multi
+    timeout: 10800
+    vars:
+      base_distro: ubuntu
+      install_type: source
+      is_upgrade: yes
+
 - job:
     name: kolla-ansible-centos8s-source-scenario-nfv
     parent: kolla-ansible-scenario-nfv-base
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index 92b826d242..6df56e5718 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -64,3 +64,7 @@
         - kolla-ansible-centos8s-source-upgrade
         - kolla-ansible-ubuntu-source
         - kolla-ansible-ubuntu-source-upgrade
+    experimental:
+      jobs:
+        - kolla-ansible-centos8s-source-swift-upgrade
+        - kolla-ansible-ubuntu-source-swift-upgrade