From c72565e0199e0a4d5cd3189dc8e25d3e5f345ea0 Mon Sep 17 00:00:00 2001 From: Daniele Rondina Date: Fri, 6 Nov 2020 23:30:37 +0100 Subject: [PATCH] Integrate tests for config protects with uninstall --- pkg/compiler/artifact.go | 3 ++- tests/integration/12_config_protect.sh | 1 + tests/integration/13_config_protect_annotation.sh | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/compiler/artifact.go b/pkg/compiler/artifact.go index a6832950..92cfbaa3 100644 --- a/pkg/compiler/artifact.go +++ b/pkg/compiler/artifact.go @@ -347,7 +347,8 @@ func (a *PackageArtifact) GetProtectFiles() []string { cp := NewConfigProtect(annotationDir) cp.Map(a.Files) - ans = cp.GetProtectFiles() + // NOTE: for unpack we need files path without initial / + ans = cp.GetProtectFiles(false) } return ans diff --git a/tests/integration/12_config_protect.sh b/tests/integration/12_config_protect.sh index b072bac0..fbc18c33 100755 --- a/tests/integration/12_config_protect.sh +++ b/tests/integration/12_config_protect.sh @@ -91,6 +91,7 @@ testUnInstall() { assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]" # TODO: we need remove it or not?? assertTrue 'config protect created' "[ -e '$tmpdir/testrootfs/etc/a/._cfg0001_conf' ]" + assertTrue 'config protect maintains the protected files' "[ -e '$tmpdir/testrootfs/etc/a/conf' ]" } diff --git a/tests/integration/13_config_protect_annotation.sh b/tests/integration/13_config_protect_annotation.sh index c45dfb26..65bc9bef 100755 --- a/tests/integration/13_config_protect_annotation.sh +++ b/tests/integration/13_config_protect_annotation.sh @@ -91,6 +91,7 @@ testUnInstall() { assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]" # TODO: we need remove it or not?? assertTrue 'config protect created' "[ -e '$tmpdir/testrootfs/opt/etc/._cfg0001_conf' ]" + assertTrue 'config protect maintains the protected files' "[ -e '$tmpdir/testrootfs/opt/etc/conf' ]" }