Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bnshr committed Aug 29, 2024
1 parent 96a8cdc commit a02842e
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 102 deletions.
2 changes: 1 addition & 1 deletion cmd/certsuite/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var (
checkCmd = &cobra.Command{
Use: "check",
Short: "check the status of workload resources or artifacts.",
Short: "check the status of certsuite resources or artifacts.",
}
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/certsuite/claim/compare/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const longHelp = `Compares sections of both claim files and the differences are shown in a table per section.
This tool can be helpful when the result of some test cases is different between two (consecutive) runs, as it shows
configuration differences in both the Workload Cert Suite config and the cluster nodes that could be the root cause for
configuration differences in both the Cert Suite config and the cluster nodes that could be the root cause for
some of the test cases results discrepancy.
All the compared sections, except the test cases results are compared blindly, traversing the whole json tree and
Expand Down Expand Up @@ -148,7 +148,7 @@ func claimCompareFilesfunc(claim1, claim2 string) error {
tcsDiffReport := testcases.GetDiffReport(claimFile1Data.Claim.Results, claimFile2Data.Claim.Results)
fmt.Println(tcsDiffReport)

// Show Workload Certification Suite configuration differences.
// Show Certification Suite configuration differences.
claim1Configurations := &claimFile1Data.Claim.Configurations
claim2Configurations := &claimFile2Data.Claim.Configurations
configurationsDiffReport := configurations.GetDiffReport(claim1Configurations, claim2Configurations)
Expand Down
4 changes: 2 additions & 2 deletions cmd/certsuite/claim/compare/configurations/configurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (c *AbnormalEventsCount) String() string {
}

type DiffReport struct {
Config *diff.Diffs `json:"WorkloadCertSuiteConfig"`
Config *diff.Diffs `json:"CertSuiteConfig"`
AbnormalEvents AbnormalEventsCount `json:"abnormalEventsCount"`
}

Expand All @@ -44,7 +44,7 @@ func (d *DiffReport) String() string {

func GetDiffReport(claim1Configurations, claim2Configurations *claim.Configurations) *DiffReport {
return &DiffReport{
Config: diff.Compare("Workload Cert Suite Configuration", claim1Configurations.Config, claim2Configurations.Config, nil),
Config: diff.Compare("Cert Suite Configuration", claim1Configurations.Config, claim2Configurations.Config, nil),
AbnormalEvents: AbnormalEventsCount{
Claim1: len(claim1Configurations.AbnormalEvents),
Claim2: len(claim2Configurations.AbnormalEvents),
Expand Down
24 changes: 12 additions & 12 deletions cmd/certsuite/claim/compare/configurations/configurations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ func TestGetDiffReport(t *testing.T) {
configs1: &claim.Configurations{},
configs2: &claim.Configurations{},
expectedDiff: &DiffReport{
Config: &diff.Diffs{Name: "Workload Cert Suite Configuration"},
Config: &diff.Diffs{Name: "Cert Suite Configuration"},
AbnormalEvents: AbnormalEventsCount{},
},
expectedDiffStr: `CONFIGURATIONS
--------------
Workload Cert Suite Configuration: Differences
Cert Suite Configuration: Differences
FIELD CLAIM 1 CLAIM 2
<none>
Workload Cert Suite Configuration: Only in CLAIM 1
Cert Suite Configuration: Only in CLAIM 1
<none>
Workload Cert Suite Configuration: Only in CLAIM 2
Cert Suite Configuration: Only in CLAIM 2
<none>
Cluster abnormal events count
Expand All @@ -57,7 +57,7 @@ CLAIM 1 CLAIM 2
AbnormalEvents: []interface{}{"event1", "event2"},
},
expectedDiff: &DiffReport{
Config: &diff.Diffs{Name: "Workload Cert Suite Configuration"},
Config: &diff.Diffs{Name: "Cert Suite Configuration"},
AbnormalEvents: AbnormalEventsCount{
Claim1: 2,
Claim2: 2,
Expand All @@ -66,14 +66,14 @@ CLAIM 1 CLAIM 2
expectedDiffStr: `CONFIGURATIONS
--------------
Workload Cert Suite Configuration: Differences
Cert Suite Configuration: Differences
FIELD CLAIM 1 CLAIM 2
<none>
Workload Cert Suite Configuration: Only in CLAIM 1
Cert Suite Configuration: Only in CLAIM 1
<none>
Workload Cert Suite Configuration: Only in CLAIM 2
Cert Suite Configuration: Only in CLAIM 2
<none>
Cluster abnormal events count
Expand All @@ -98,7 +98,7 @@ CLAIM 1 CLAIM 2
},
expectedDiff: &DiffReport{
Config: &diff.Diffs{
Name: "Workload Cert Suite Configuration",
Name: "Cert Suite Configuration",
Fields: []diff.FieldDiff{{
FieldPath: "/field1",
Claim1Value: "value1",
Expand All @@ -114,14 +114,14 @@ CLAIM 1 CLAIM 2
expectedDiffStr: `CONFIGURATIONS
--------------
Workload Cert Suite Configuration: Differences
Cert Suite Configuration: Differences
FIELD CLAIM 1 CLAIM 2
/field1 value1 value11
Workload Cert Suite Configuration: Only in CLAIM 1
Cert Suite Configuration: Only in CLAIM 1
<none>
Workload Cert Suite Configuration: Only in CLAIM 2
Cert Suite Configuration: Only in CLAIM 2
/field2/subfield1=58
Cluster abnormal events count
Expand Down
26 changes: 13 additions & 13 deletions cmd/certsuite/claim/compare/versions/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ func TestCompare(t *testing.T) {
K8s: "22",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555",
CertsuiteGitCommit: "666666",
CertSuite: "55555",
CertSuiteGitCommit: "666666",
},
claim2Versions: &officialClaimScheme.Versions{
ClaimFormat: "1",
K8s: "22",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555",
CertsuiteGitCommit: "666666",
CertSuite: "55555",
CertSuiteGitCommit: "666666",
},
},
want: &DiffReport{Diffs: &diff.Diffs{Name: "VERSIONS"}},
Expand All @@ -56,16 +56,16 @@ func TestCompare(t *testing.T) {
K8s: "22AAA",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555",
CertsuiteGitCommit: "666666",
CertSuite: "55555",
CertSuiteGitCommit: "666666",
},
claim2Versions: &officialClaimScheme.Versions{
ClaimFormat: "1",
K8s: "22",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555",
CertsuiteGitCommit: "666666",
CertSuite: "55555",
CertSuiteGitCommit: "666666",
},
},
want: &DiffReport{Diffs: &diff.Diffs{
Expand All @@ -87,16 +87,16 @@ func TestCompare(t *testing.T) {
K8s: "22AAA",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555",
CertsuiteGitCommit: "666666",
CertSuite: "55555",
CertSuiteGitCommit: "666666",
},
claim2Versions: &officialClaimScheme.Versions{
ClaimFormat: "1",
K8s: "22",
OcClient: "333",
Ocp: "4444",
Certsuite: "55555BBBB",
CertsuiteGitCommit: "666666",
CertSuite: "55555BBBB",
CertSuiteGitCommit: "666666",
},
},
want: &DiffReport{Diffs: &diff.Diffs{
Expand All @@ -108,7 +108,7 @@ func TestCompare(t *testing.T) {
Claim2Value: "22",
},
{
FieldPath: "/workload",
FieldPath: "/certsuite",
Claim1Value: "55555",
Claim2Value: "55555BBBB",
},
Expand Down
10 changes: 5 additions & 5 deletions cmd/certsuite/claim/show/failures/failures.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Test Suite: access-control
Description: Ensures that containers do not use SYS_ADMIN capability
Failure reasons:
1 - Type: Container, Reason: Non compliant capability detected in container
Namespace: workload, Pod Name: test-887998557-8gwwm, Container Name: test, SCC Capability: SYS_ADMIN
Namespace: certsuite, Pod Name: test-887998557-8gwwm, Container Name: test, SCC Capability: SYS_ADMIN
2 - Type: Container, Reason: Non compliant capability detected in container
Namespace: workload, Pod Name: test-887998557-pr2w5, Container Name: test, SCC Capability: SYS_ADMIN
Namespace: certsuite, Pod Name: test-887998557-pr2w5, Container Name: test, SCC Capability: SYS_ADMIN
Test Case: access-control-security-context
Description: Checks the security context matches one of the 4 categories
Failure reasons:
1 - Type: ContainerCategory, Reason: container category is NOT category 1 or category NoUID0
Namespace: workload, Pod Name: jack-6f88b5bfb4-q5cw6, Container Name: jack, Category: CategoryID4(anything not matching lower category)
Namespace: certsuite, Pod Name: jack-6f88b5bfb4-q5cw6, Container Name: jack, Category: CategoryID4(anything not matching lower category)
2 - ...
...
Test Suite: lifecycle
Expand All @@ -60,7 +60,7 @@ Test Suite: lifecycle
"type": "Container",
"reason": "Non compliant capability detected in container",
"spec": {
"Namespace": "workload",
"Namespace": "certsuite",
"Pod Name": "test-887998557-8gwwm",
"Container Name": "test",
"SCC Capability": "SYS_ADMIN"
Expand All @@ -70,7 +70,7 @@ Test Suite: lifecycle
"type": "Container",
"reason": "Non compliant capability detected in container",
"spec": {
"Namespace": "workload",
"Namespace": "certsuite",
"Pod Name": "test-887998557-pr2w5",
"Container Name": "test",
"SCC Capability": "SYS_ADMIN"
Expand Down
16 changes: 8 additions & 8 deletions cmd/certsuite/claim/show/failures/failures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
],
"ObjectFieldsValues": [
"Non compliant capability detected in container",
"workload",
"certSuite",
"test-887998557-8gwwm",
"test",
"SYS_ADMIN"
Expand All @@ -138,7 +138,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
}{
{
Key: "Namespace",
Value: "workload",
Value: "certSuite",
},
{
Key: "Pod Name",
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
],
"ObjectFieldsValues": [
"Non compliant capability detected in container",
"workload",
"certSuite",
"test-887998557-8gwwm",
"test",
"SYS_ADMIN"
Expand All @@ -190,7 +190,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
],
"ObjectFieldsValues": [
"Non compliant capability detected in container",
"workload",
"certSuite",
"test-887998557-pr2w5",
"test",
"SYS_ADMIN"
Expand All @@ -210,7 +210,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
}{
{
Key: "Namespace",
Value: "workload",
Value: "certSuite",
},
{
Key: "Pod Name",
Expand All @@ -237,7 +237,7 @@ func TestGetNonCompliantObjectsFromFailureReason(t *testing.T) {
}{
{
Key: "Namespace",
Value: "workload",
Value: "certSuite",
},
{
Key: "Pod Name",
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestGetFailedTestCasesByTestSuite(t *testing.T) {
}{
{
Key: "Namespace",
Value: "workload",
Value: "certSuite",
},
{
Key: "Pod Name",
Expand All @@ -349,7 +349,7 @@ func TestGetFailedTestCasesByTestSuite(t *testing.T) {
}{
{
Key: "Namespace",
Value: "workload",
Value: "certSuite",
},
{
Key: "Pod Name",
Expand Down
Loading

0 comments on commit a02842e

Please sign in to comment.