Skip to content

Commit 5661829

Browse files
Merge pull request #996 from Anna-Koudelkova/CMP-3776
CMP-3776: Enhance TestSingleTailoredScanSucceeds to cover 33398 logic
2 parents 3c5dbd6 + a0a0208 commit 5661829

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/e2e/parallel/main_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,19 @@ func TestSingleTailoredScanSucceeds(t *testing.T) {
11461146
Rationale: "Test for platform profile tailoring",
11471147
},
11481148
},
1149+
DisableRules: []compv1alpha1.RuleReferenceSpec{
1150+
{
1151+
Name: "rhcos4-audit-rules-dac-modification-chmod",
1152+
Rationale: "Disable rule for testing",
1153+
},
1154+
},
1155+
SetValues: []compv1alpha1.VariableValueSpec{
1156+
{
1157+
Name: "rhcos4-var-selinux-state",
1158+
Rationale: "Set variable value for testing",
1159+
Value: "permissive",
1160+
},
1161+
},
11491162
},
11501163
}
11511164
err := f.Client.Create(context.TODO(), tp, nil)
@@ -1159,6 +1172,31 @@ func TestSingleTailoredScanSucceeds(t *testing.T) {
11591172
t.Fatal(err)
11601173
}
11611174

1175+
// Verify the tailored profile details through ConfigMap
1176+
tpConfigMapName := fmt.Sprintf("%s-tp", tpName)
1177+
tpConfigMap := &corev1.ConfigMap{}
1178+
err = f.Client.Get(context.TODO(), types.NamespacedName{
1179+
Name: tpConfigMapName,
1180+
Namespace: f.OperatorNamespace,
1181+
}, tpConfigMap)
1182+
if err != nil {
1183+
t.Fatal(err)
1184+
}
1185+
1186+
tailoringData, ok := tpConfigMap.Data["tailoring.xml"]
1187+
if !ok {
1188+
t.Fatal(err)
1189+
}
1190+
for _, expected := range []string{
1191+
"\"xccdf_org.ssgproject.content_rule_no_netrc_files\" selected=\"true\"",
1192+
"\"xccdf_org.ssgproject.content_rule_audit_rules_dac_modification_chmod\" selected=\"false\"",
1193+
"\"xccdf_org.ssgproject.content_value_var_selinux_state\">permissive",
1194+
} {
1195+
if !strings.Contains(tailoringData, expected) {
1196+
t.Fatal(err)
1197+
}
1198+
}
1199+
11621200
suiteName := framework.GetObjNameFromTest(t)
11631201
ssb := &compv1alpha1.ScanSettingBinding{
11641202
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)