From 8453c368c13f38038d0346b4d15fc03781fcff51 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Tue, 12 Oct 2021 15:03:25 +0000 Subject: [PATCH] pkgng: test annotation for single package Add/modify/remove annotation for a single package --- .../targets/pkgng/tasks/freebsd.yml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/integration/targets/pkgng/tasks/freebsd.yml b/tests/integration/targets/pkgng/tasks/freebsd.yml index 5f0aee00f3..09d34f041e 100644 --- a/tests/integration/targets/pkgng/tasks/freebsd.yml +++ b/tests/integration/targets/pkgng/tasks/freebsd.yml @@ -294,6 +294,57 @@ - "'autoremoved' is in(pkgng_example7.msg)" - not pkgng_example7_cleanup.changed +## +## pkgng - example - single annotations +## +- name: Install and annotate single package + pkgng: + name: '{{ pkgng_test_pkg_name }}' + annotation: '+ansibletest=added' + register: pkgng_example8_add_annotation + +- name: Install and annotate single package + pkgng: + name: '{{ pkgng_test_pkg_name }}' + annotation: '+ansibletest=duplicate' + ignore_errors: yes + register: pkgng_example8_add_annotation_failure + +- name: Verify annotation is actually there + command: 'pkg annotate -q -S {{ pkgng_test_pkg_name }} ansibletest' + register: pkgng_example8_add_annotation_verify + +- name: Modify annotation on single package + pkgng: + name: '{{ pkgng_test_pkg_name }}' + annotation: ':ansibletest=modified' + register: pkgng_example8_modify_annotation + +- name: Verify annotation has been modified + command: 'pkg annotate -q -S {{ pkgng_test_pkg_name }} ansibletest' + register: pkgng_example8_modify_annotation_verify + +- name: Remove annotation on single package + pkgng: + name: '{{ pkgng_test_pkg_name }}' + annotation: '-ansibletest' + register: pkgng_example8_remove_annotation + +- name: Verify annotation has been removed + command: 'pkg annotate -q -S {{ pkgng_test_pkg_name }} ansibletest' + register: pkgng_example8_remove_annotation_verify + +- name: Ensure pkgng annotations on single packages work correctly + assert: + that: + - pkgng_example8_add_annotation.changed + - pkgng_example8_add_annotation_failure.failed + - 'pkgng_example8_add_annotation_verify.stdout_lines | first == "added"' + - pkgng_example8_modify_annotation.changed + - 'pkgng_example8_modify_annotation_verify.stdout_lines | first == "modified"' + - pkgng_example8_remove_annotation.changed + - 'pkgng_example8_remove_annotation_verify.stdout_lines | count == 0' + ## ## pkgng - example - Install single package in jail ##