summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Wood <gene_wood@cementhorizon.com>2022-08-09 14:44:52 -0700
committerGene Wood <gene_wood@cementhorizon.com>2022-08-09 14:44:52 -0700
commit36f59fb27102eef1dce49112c6649933dddf04fd (patch)
tree22b0b223e96415e04c4ca71feef66b078c772785
parent748b0fc9f3afa62f320469a0a82f875ed7fa30a3 (diff)
downloadchef-36f59fb27102eef1dce49112c6649933dddf04fd.tar.gz
Add snap tests
This enables snap dokken tests which were previously disabled in #9993 per @johnmccrae 's comment[1] It also changes the test package from "black" to "hello". "hello" is a Canonical package that should hopefully have little change over time and is smaller than "black" This commit adds tests for * `action :install` * `action :upgrade` * `action :remove` * `action :purge` * the `options` property * the `channel` property * installing multiple snaps This doesn't add a test for the `version` property as that would require knowing a version that will be available in a channel over the long term (as you can only install the version present in a given channel unless you have developer access to snapcraft for the given snap). We could add a `version` property test and just hope that Canonical won't upgrade the `hello` snap. This is also missing a test for the `source` property (as we'd need a local snap package file) and the `timeout` property as I'm not sure how to test this. [1]: https://github.com/chef/chef/pull/13025#issuecomment-1169264594 Signed-off-by: Gene Wood <gene_wood@cementhorizon.com>
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb29
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/linux.rb4
2 files changed, 28 insertions, 5 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
index 0a4ba48a58..7d7845f0af 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_snap.rb
@@ -8,7 +8,32 @@ end
execute "sleep 5"
-snap_package "black" do
+snap_package "hello" do
+ action :install
+ channel "stable"
+end
+
+snap_package "hello" do
action :upgrade
- channel "beta"
+ channel "edge"
+end
+
+snap_package "hello" do
+ action :remove
+end
+
+snap_package "hello"
+
+snap_package "hello" do
+ action :purge
+end
+
+snap_package "hello" do
+ options ["devmode"]
end
+
+snap_package "hello" do
+ action :remove
+end
+
+snap_package %w(hello black) \ No newline at end of file
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
index 079f66f511..5a4f0646c6 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
@@ -156,6 +156,4 @@ if ::File.exist?("/etc/systemd/system")
include_recipe "::_habitat_user_toml"
end
-# at the moment these do not run properly in docker
-# we need to investigate if this is a snap on docker issue or a chef issue
-# include_recipe "::_snap" if platform?("ubuntu")
+include_recipe "::_snap" if platform?("ubuntu")