diff mbox series

[ACT] UBUNTU: SAUCE: ubuntu_sysdig_smoke_test/ubuntu_lttng_smoke_test: always try to install DKMS when test starts

Message ID 20210609082953.18214-1-po-hsu.lin@canonical.com
State New
Headers show
Series [ACT] UBUNTU: SAUCE: ubuntu_sysdig_smoke_test/ubuntu_lttng_smoke_test: always try to install DKMS when test starts | expand

Commit Message

Po-Hsu Lin June 9, 2021, 8:29 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1931338

The DKMS package for these 2 tests will be removed with cleanup() in
the end of the test. This is for our manually provisioned system (bug
1798295), and it's also a good practice to keep the system clean after
the test.

However, since we only run setup() once if the test version is not
bumped, when you try to restart these tests on the same system without
removing autotest/client/tmp/<test suite> directory, they will fail
due to the lack of corresponding modules.

Solution for this is to move code in setup() into initialize(), which
is guaranteed to be executed on every run.

This is the workflow for a test:
1. initialize()
2. setup()
3. run_once()
4. cleanup()

With a second run immediately after the first one:
5. initialize()
6. run_once()
7. cleanup()

Code tested on an Azure instance and a bare-metal node.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py   | 3 ---
 ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py | 3 ---
 2 files changed, 6 deletions(-)

Comments

Krzysztof Kozlowski June 9, 2021, 11:13 a.m. UTC | #1
On 09/06/2021 10:29, Po-Hsu Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/1931338
> 
> The DKMS package for these 2 tests will be removed with cleanup() in
> the end of the test. This is for our manually provisioned system (bug
> 1798295), and it's also a good practice to keep the system clean after
> the test.
> 
> However, since we only run setup() once if the test version is not
> bumped, when you try to restart these tests on the same system without
> removing autotest/client/tmp/<test suite> directory, they will fail
> due to the lack of corresponding modules.
> 
> Solution for this is to move code in setup() into initialize(), which
> is guaranteed to be executed on every run.
> 
> This is the workflow for a test:
> 1. initialize()
> 2. setup()
> 3. run_once()
> 4. cleanup()
> 
> With a second run immediately after the first one:
> 5. initialize()
> 6. run_once()
> 7. cleanup()
> 
> Code tested on an Azure instance and a bare-metal node.
> 
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---
>  ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py   | 3 ---
>  ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py | 3 ---
>  2 files changed, 6 deletions(-)
> 


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof
Colin Ian King June 9, 2021, 11:15 a.m. UTC | #2
On 09/06/2021 09:29, Po-Hsu Lin wrote:
> BugLink: https://bugs.launchpad.net/bugs/1931338
> 
> The DKMS package for these 2 tests will be removed with cleanup() in
> the end of the test. This is for our manually provisioned system (bug
> 1798295), and it's also a good practice to keep the system clean after
> the test.
> 
> However, since we only run setup() once if the test version is not
> bumped, when you try to restart these tests on the same system without
> removing autotest/client/tmp/<test suite> directory, they will fail
> due to the lack of corresponding modules.
> 
> Solution for this is to move code in setup() into initialize(), which
> is guaranteed to be executed on every run.
> 
> This is the workflow for a test:
> 1. initialize()
> 2. setup()
> 3. run_once()
> 4. cleanup()
> 
> With a second run immediately after the first one:
> 5. initialize()
> 6. run_once()
> 7. cleanup()
> 
> Code tested on an Azure instance and a bare-metal node.
> 
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---
>  ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py   | 3 ---
>  ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py | 3 ---
>  2 files changed, 6 deletions(-)
> 
> diff --git a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
> index 434a5ac2..2779dcbf 100755
> --- a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
> +++ b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
> @@ -30,9 +30,6 @@ class ubuntu_lttng_smoke_test(test.test):
>          self.results = utils.system_output(cmd, retain_output=True, ignore_status=True)
>  
>      def initialize(self):
> -        pass
> -
> -    def setup(self):
>          # Special case for Azure nodes lp: 1791032
>          # Some nodes with small ram will need the swap to build lttng dkms
>          if platform.uname()[2].split('-')[-1] == 'azure':
> diff --git a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
> index c844b852..d2dc3751 100755
> --- a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
> +++ b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
> @@ -15,9 +15,6 @@ class ubuntu_sysdig_smoke_test(test.test):
>          self.results = utils.system_output(cmd, retain_output=True, ignore_status=True)
>  
>      def initialize(self):
> -        pass
> -
> -    def setup(self):
>          self.install_required_pkgs()
>          cmd = 'dkms status -m sysdig | grep installed'
>          try:
> 

Thanks for sorting this out.

Acked-by: Colin Ian King <colin.king@canonical.com>
Po-Hsu Lin June 10, 2021, 2:20 a.m. UTC | #3
Applied and pushed.

Thanks
Sam
diff mbox series

Patch

diff --git a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
index 434a5ac2..2779dcbf 100755
--- a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
+++ b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
@@ -30,9 +30,6 @@  class ubuntu_lttng_smoke_test(test.test):
         self.results = utils.system_output(cmd, retain_output=True, ignore_status=True)
 
     def initialize(self):
-        pass
-
-    def setup(self):
         # Special case for Azure nodes lp: 1791032
         # Some nodes with small ram will need the swap to build lttng dkms
         if platform.uname()[2].split('-')[-1] == 'azure':
diff --git a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
index c844b852..d2dc3751 100755
--- a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
+++ b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.py
@@ -15,9 +15,6 @@  class ubuntu_sysdig_smoke_test(test.test):
         self.results = utils.system_output(cmd, retain_output=True, ignore_status=True)
 
     def initialize(self):
-        pass
-
-    def setup(self):
         self.install_required_pkgs()
         cmd = 'dkms status -m sysdig | grep installed'
         try: