From c73304835c88f5387a38c2e3cc8d54b9d42ce6aa Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 15 Mar 2022 18:54:01 +0000 Subject: [PATCH] feat(test_includes): add MRE for Salt `master` branch regression --- .gitlab-ci.yml | 25 +++++++++---------- .travis.yml | 2 ++ TEST/init.sls | 5 ++++ TEST/test_includes/init.sls | 6 +++++ TEST/test_includes/notification.sls | 22 +++++++++++++++++ TEST/test_includes/package.sls | 6 +++++ kitchen.yml | 38 +++++++++++++++++------------ 7 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 TEST/init.sls create mode 100644 TEST/test_includes/init.sls create mode 100644 TEST/test_includes/notification.sls create mode 100644 TEST/test_includes/package.sls diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0745680..c60e08f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,19 +131,18 @@ rubocop: # Make sure the instances listed below match up with # the `platforms` defined in `kitchen.yml` # yamllint disable rule:line-length -# default-debian-11-tiamat-py3: {extends: '.test_instance'} -# default-debian-10-tiamat-py3: {extends: '.test_instance'} -# default-debian-9-tiamat-py3: {extends: '.test_instance'} -default-debian-11-master-py3: {extends: '.test_instance'} -default-debian-10-master-py3: {extends: '.test_instance'} -default-debian-9-master-py3: {extends: '.test_instance'} -# default-debian-11-3004-0-py3: {extends: '.test_instance'} -# default-debian-10-3004-0-py3: {extends: '.test_instance'} -# default-debian-9-3004-0-py3: {extends: '.test_instance'} -# default-debian-10-3003-3-py3: {extends: '.test_instance'} -# default-debian-9-3003-3-py3: {extends: '.test_instance'} -# default-debian-10-3002-7-py3: {extends: '.test_instance'} -# default-debian-9-3002-7-py3: {extends: '.test_instance'} +# include-using-dot-notation-debian-11-master-py3: {extends: '.test_instance'} +# include-using-slash-notation-debian-11-master-py3: {extends: '.test_instance'} +include-using-dot-notation-debian-10-master-py3: {extends: '.test_instance'} +include-using-slash-notation-debian-10-master-py3: {extends: '.test_instance'} +# include-using-dot-notation-debian-9-master-py3: {extends: '.test_instance'} +# include-using-slash-notation-debian-9-master-py3: {extends: '.test_instance'} +# include-using-dot-notation-debian-11-3004-0-py3: {extends: '.test_instance'} +# include-using-slash-notation-debian-11-3004-0-py3: {extends: '.test_instance'} +include-using-dot-notation-debian-10-3004-0-py3: {extends: '.test_instance'} +include-using-slash-notation-debian-10-3004-0-py3: {extends: '.test_instance'} +# include-using-dot-notation-debian-9-3004-0-py3: {extends: '.test_instance'} +# include-using-slash-notation-debian-9-3004-0-py3: {extends: '.test_instance'} # yamllint enable rule:line-length ############################################################################### diff --git a/.travis.yml b/.travis.yml index f35884f..5b7ed88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,6 +88,8 @@ jobs: # - env: INSTANCE=default-debian-9-tiamat-py3 - env: INSTANCE=default-debian-11-master-py3 - env: INSTANCE=default-debian-10-master-py3 + - env: INSTANCE=include-using-dot-notation-debian-10-master-py3 + - env: INSTANCE=include-using-slash-notation-debian-10-master-py3 - env: INSTANCE=default-debian-9-master-py3 # - env: INSTANCE=default-debian-11-3004-0-py3 # - env: INSTANCE=default-debian-10-3004-0-py3 diff --git a/TEST/init.sls b/TEST/init.sls new file mode 100644 index 0000000..4ea211d --- /dev/null +++ b/TEST/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .test_includes diff --git a/TEST/test_includes/init.sls b/TEST/test_includes/init.sls new file mode 100644 index 0000000..b652de6 --- /dev/null +++ b/TEST/test_includes/init.sls @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .package + - .notification diff --git a/TEST/test_includes/notification.sls b/TEST/test_includes/notification.sls new file mode 100644 index 0000000..f4ec6d1 --- /dev/null +++ b/TEST/test_includes/notification.sls @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{%- from "../map.jinja" import mapdata as TEST with context %} + +include: + {#- Use Jinja to construct the relevant include using dots or slashes, + where `TEST.test_includes.include_notation` is either `.` or `/`. + + Dot notation is used throughout the SaltStack Formulas organisation, i.e.: + - TEST.test_includes.package + + Slash notation is mentioned in the bug report (https://github.com/saltstack/salt/pull/61659), i.e. + - TEST/test_includes/package + #} + - {{ ["TEST", "test_includes", "package"] | join(TEST.test_includes.include_notation) }} + +TEST/test_includes/notification/test.show_notification: + test.show_notification: + - text: Package installed + - require: + - pkg: TEST/test_includes/package/pkg.installed diff --git a/TEST/test_includes/package.sls b/TEST/test_includes/package.sls new file mode 100644 index 0000000..8614173 --- /dev/null +++ b/TEST/test_includes/package.sls @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +TEST/test_includes/package/pkg.installed: + pkg.installed: + - name: git diff --git a/kitchen.yml b/kitchen.yml index 7748d24..1c03280 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -17,6 +17,15 @@ provisioner: salt_copy_filter: - .kitchen - .git + state_top: + base: + '*': + - TEST + pillars: + top.sls: + base: + '*': + - TEST platforms: ## SALT `tiamat` @@ -40,7 +49,7 @@ platforms: run_command: /lib/systemd/systemd - name: debian-10-master-py3 driver: - image: saltimages/salt-master-py3:debian-10 + image: myii/salt-master-py3:debian-10 run_command: /lib/systemd/systemd - name: debian-9-master-py3 driver: @@ -90,20 +99,17 @@ verifier: - cli suites: - - name: default + - name: include-using-dot-notation provisioner: - state_top: - base: - '*': - - TEST._mapdata - - TEST pillars: - top.sls: - base: - '*': - - TEST - pillars_from_files: - TEST.sls: pillar.example - verifier: - inspec_tests: - - path: test/integration/default + TEST.sls: + TEST: + test_includes: + include_notation: "." + - name: include-using-slash-notation + provisioner: + pillars: + TEST.sls: + TEST: + test_includes: + include_notation: "/"