From 248128f282c9e10cecf507da78ec4a323c40472b Mon Sep 17 00:00:00 2001
From: Felix Fontein <felix@fontein.de>
Date: Fri, 12 Feb 2021 08:23:31 +0100
Subject: [PATCH] [stable-1] Add ubuntu2004, upgrade CI to be more similar to
 main (#1792)

* Add Ubuntu 20.04 to CI (#1658)

* Add Ubuntu 20.04 to CI.

* Skip mqtt test on Ubuntu 20.04.

* Use explicit disable instead of aliases.

* Add Ubuntu 20.04 specific config for setup_postgresql_db.

* Fix postgres version.

(cherry picked from commit 4223f48d3847dbea37de358a5c6ef131acdbb39f)

* Adjust AZP config.

* Remove some tests.

* Make more similar to config fromm main branch.
---
 .azure-pipelines/azure-pipelines.yml          | 38 +++++++------------
 tests/integration/targets/mqtt/tasks/main.yml |  2 +-
 .../vars/Ubuntu-20-py3.yml                    |  8 ++++
 3 files changed, 23 insertions(+), 25 deletions(-)
 create mode 100644 tests/integration/targets/setup_postgresql_db/vars/Ubuntu-20-py3.yml

diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml
index e297cdbb9f..d174dc6f9a 100644
--- a/.azure-pipelines/azure-pipelines.yml
+++ b/.azure-pipelines/azure-pipelines.yml
@@ -13,7 +13,7 @@ pr:
       - stable-*
 
 schedules:
-  - cron: 0 9 * * *
+  - cron: 0 8 * * *
     displayName: Nightly
     always: true
     branches:
@@ -179,9 +179,6 @@ stages:
           groups:
             - 1
             - 2
-            - 3
-            - 4
-            - 5
   - stage: Remote_2_9
     displayName: Remote 2.9
     dependsOn: []
@@ -192,14 +189,11 @@ stages:
           targets:
             - name: RHEL 8.2
               test: rhel/8.2
-            #- name: FreeBSD 12.0
-            #  test: freebsd/12.0
+            - name: FreeBSD 12.0
+              test: freebsd/12.0
           groups:
             - 1
             - 2
-            - 3
-            - 4
-            - 5
 
 ### Docker
   - stage: Docker_devel
@@ -226,6 +220,8 @@ stages:
               test: opensuse15
             - name: Ubuntu 18.04
               test: ubuntu1804
+            - name: Ubuntu 20.04
+              test: ubuntu2004
           groups:
             - 1
             - 2
@@ -240,18 +236,15 @@ stages:
         parameters:
           testFormat: 2.10/linux/{0}
           targets:
-            #- name: CentOS 8
-            #  test: centos8
+            - name: CentOS 8
+              test: centos8
             - name: Fedora 32
               test: fedora32
             - name: openSUSE 15 py3
               test: opensuse15
             - name: Ubuntu 16.04
               test: ubuntu1604
-            #- name: Ubuntu 18.04
-            #  test: ubuntu1804
           groups:
-            - 1
             - 2
             - 3
             - 4
@@ -264,16 +257,13 @@ stages:
         parameters:
           testFormat: 2.9/linux/{0}
           targets:
-            #- name: CentOS 8
-            #  test: centos8
-            #- name: Fedora 31
-            #  test: fedora31
-            #- name: openSUSE 15 py3
-            #  test: opensuse15
-            - name: Ubuntu 18.04
-              test: ubuntu1804
+            - name: CentOS 8
+              test: centos8
+            - name: Fedora 31
+              test: fedora31
+            - name: openSUSE 15 py3
+              test: opensuse15
           groups:
-            - 1
             - 2
             - 3
             - 4
@@ -310,7 +300,7 @@ stages:
           nameFormat: Python {0}
           testFormat: 2.9/cloud/{0}/1
           targets:
-            - test: 2.7
+            - test: 3.6
   - stage: Summary
     condition: succeededOrFailed()
     dependsOn:
diff --git a/tests/integration/targets/mqtt/tasks/main.yml b/tests/integration/targets/mqtt/tasks/main.yml
index 74e06f320c..c5dcf3bec7 100644
--- a/tests/integration/targets/mqtt/tasks/main.yml
+++ b/tests/integration/targets/mqtt/tasks/main.yml
@@ -6,4 +6,4 @@
 - include: ubuntu.yml
   when: 
     - ansible_distribution == 'Ubuntu'
-    - ansible_distribution_release != 'trusty'
+    - ansible_distribution_release not in ['trusty', 'focal']
diff --git a/tests/integration/targets/setup_postgresql_db/vars/Ubuntu-20-py3.yml b/tests/integration/targets/setup_postgresql_db/vars/Ubuntu-20-py3.yml
new file mode 100644
index 0000000000..7322bcb216
--- /dev/null
+++ b/tests/integration/targets/setup_postgresql_db/vars/Ubuntu-20-py3.yml
@@ -0,0 +1,8 @@
+postgresql_packages:
+  - "postgresql"
+  - "postgresql-common"
+  - "python3-psycopg2"
+
+pg_hba_location: "/etc/postgresql/12/main/pg_hba.conf"
+pg_dir: "/var/lib/postgresql/12/main"
+pg_ver: 12