Skip to content

Commit

Permalink
Merge branch 'main' into test-pr-tnf-secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
shirmoran authored Oct 25, 2023
2 parents b32f838 + 9858e15 commit 4fdf90e
Show file tree
Hide file tree
Showing 20 changed files with 1,682 additions and 162 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/pre-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: 1.21.2

# Prepare collector to be used when running smoke tests
- name: Check out `Collector`
uses: actions/checkout@v4
Expand Down Expand Up @@ -426,7 +427,7 @@ jobs:
- name: 'Test: Run Smoke Tests in a TNF container'
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} TNF_ENABLE_DATA_COLLECTION=true ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -l "${SMOKE_TESTS_GINKGO_LABELS_FILTER}"

# Perform tests on collector
# Prepare collector to be used when running smoke tests
- name: Check out `Collector`
uses: actions/checkout@v4
with:
Expand All @@ -442,6 +443,11 @@ jobs:
with:
working_directory: collector

# - name: Run sanity check on collector
# uses: ./collector/.github/actions/run-sanity-check
# with:
# working_directory: collector

- name: Upload container test results as an artifact
uses: actions/upload-artifact@v3
if: always()
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi8/ubi:8.8-1067.1696517599 AS build
FROM registry.access.redhat.com/ubi8/ubi:8.8-1067.1698056881 AS build
ENV TNF_DIR=/usr/tnf
ENV \
TNF_SRC_DIR=${TNF_DIR}/tnf-src \
Expand Down Expand Up @@ -99,7 +99,7 @@ FROM quay.io/testnetworkfunction/oct:latest AS db

# Copy the state into a new flattened image to reduce size.
# TODO run as non-root
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-1072.1696517598
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-1072.1697626218

ENV \
TNF_DIR=/usr/tnf \
Expand Down
2 changes: 1 addition & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
iif = "iif"

[files]
extend-exclude = ["go.mod", "results.html", "cmd/tnf/claim/compare/testdata", "docs/assets/images/demo-config.svg"]
extend-exclude = ["go.mod", "results.html", "cmd/tnf/claim/compare/testdata", "docs/assets/images/*.svg"]
67 changes: 64 additions & 3 deletions cmd/tnf/claim/compare/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,75 @@ import (
"github.com/test-network-function/cnf-certification-test/cmd/tnf/pkg/claim"
)

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 CNF 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
substrees to get a list of all the fields and their values. Three tables are shown:
- Differences: same fields with different values.
- Fields in claim 1 only: json fields in claim file 1 that don't exist in claim 2.
- Fields in claim 2 only: json fields in claim file 2 that don't exist in claim 1.
Let's say one of the nodes of the claim.json file contains this struct:
{
"field1": "value1",
"field2": {
"field3": "value2",
"field4": {
"field5": "value3",
"field6": "value4"
}
}
}
When parsing that json struct fields, it will produce a list of fields like this:
/field1=value1
/field2/field3=value2
/field2/field4/field5=value3
/field2/field4/field6=finalvalue2
Once this list of field's path+value strings has been obtained from both claim files,
it is compared in order to find the differences or the fields that only exist on each file.
This is a fake example of a node "clus0-0" whose first CNI (index 0) has a different cniVersion
and the ipMask flag of its first plugin (also index 0) has changed to false in the second run.
Also, the plugin has another "newFakeFlag" config flag in claim 2 that didn't exist in clam file 1.
...
CNIs: Differences
FIELD CLAIM 1 CLAIM 2
/clus0-0/0/cniVersion 1.0.0 1.0.1
/clus0-1/0/plugins/0/ipMasq true false
CNIs: Only in CLAIM 1
<none>
CNIs: Only in CLAIM 2
/clus0-1/0/plugins/0/newFakeFlag=true
...
Currently, the following sections are compared, in this order:
- claim.versions
- claim.Results
- claim.configurations.Config
- claim.nodes.cniPlugins
- claim.nodes.csiDriver
- claim.nodes.nodesHwInfo
- claim.nodes.nodeSummary
`

var (
Claim1FilePathFlag string
Claim2FilePathFlag string

claimCompareFiles = &cobra.Command{
Use: "compare",
Short: "Compare two claim files.",
RunE: claimCompare,
Use: "compare",
Short: "Compare two claim files.",
Long: longHelp,
Example: "claim compare -1 claim1.json -2 claim2.json",
RunE: claimCompare,
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
4.11.5 / 411.86.202209140028-0
4.11.50 / 411.86.202309200611-0
4.11.51 / 411.86.202310091037-0
4.11.52 / 411.86.202310140407-0
4.11.6 / 411.86.202209211811-0
4.11.7 / 411.86.202209211811-0
4.11.8 / 411.86.202210032349-0
Expand Down Expand Up @@ -181,7 +182,9 @@
4.12.36 / 412.86.202309200923-0
4.12.37 / 412.86.202309281644-0
4.12.38 / 412.86.202310111011-0
4.12.39 / 412.86.202310141028-0
4.12.4 / 412.86.202302091419-0
4.12.40 / 412.86.202310170023-0
4.12.5 / 412.86.202302170236-0
4.12.6 / 412.86.202302282003-0
4.12.7 / 412.86.202303011010-0
Expand Down Expand Up @@ -209,6 +212,7 @@
4.13.15 / 413.92.202310021538-0
4.13.16 / 413.92.202310100714-0
4.13.17 / 413.92.202310141129-0
4.13.18 / 413.92.202310170351-0
4.13.2 / 413.92.202305302312-0
4.13.3 / 413.92.202306070210-0
4.13.4 / 413.92.202306141213-0
Expand Down
Loading

0 comments on commit 4fdf90e

Please sign in to comment.