Skip to content
This repository was archived by the owner on Aug 26, 2022. It is now read-only.

Commit ed6aed2

Browse files
sebrandon1edcdavidhamadiseaabughoshgreyerof
authored
Bringing v3.3.x up to main (#656)
Copying the `main` branch over to the `3.3.x` branch. Co-authored-by: edcdavid <[email protected]> Co-authored-by: Salaheddine Hamadi <[email protected]> Co-authored-by: aabughosh <[email protected]> Co-authored-by: Gonzalo Reyero Ferreras <[email protected]> Co-authored-by: Shimrit Peretz <[email protected]> Co-authored-by: Shimrit peretz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jmontesi <[email protected]> Co-authored-by: Shai Oren <[email protected]> Co-authored-by: Ramon Perez <[email protected]> Co-authored-by: David Elie-Dit-Cosaque <[email protected]> Co-authored-by: Gonzalo Reyero Ferreras <[email protected]>
1 parent 3e9378a commit ed6aed2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2233
-1235
lines changed

.github/workflows/merge.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go 1.17
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: 1.17.6
18+
go-version: 1.17.8
1919

2020
- name: Check out code into the Go module directory
2121
uses: actions/checkout@v2

.github/workflows/pre-main.yaml

+16-11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
TESTING_CMD_PARAMS: '-n host -i ${REGISTRY_LOCAL}/${IMAGE_NAME}:${IMAGE_TAG} -t ${TNF_CONFIG_DIR} -o ${TNF_OUTPUT_DIR}'
2121
TNF_PARTNER_DIR: '/usr/tnf-partner'
2222
TNF_PARTNER_SRC_DIR: '${TNF_PARTNER_DIR}/src'
23+
TERM: xterm-color
2324

2425
jobs:
2526
lint:
@@ -30,7 +31,10 @@ jobs:
3031
- name: Set up Go 1.17
3132
uses: actions/setup-go@v2
3233
with:
33-
go-version: 1.17.6
34+
go-version: 1.17.8
35+
36+
- name: Disable default go problem matcher
37+
run: echo "::remove-matcher owner=go::"
3438

3539
- name: Check out code into the Go module directory
3640
uses: actions/checkout@v2
@@ -78,7 +82,10 @@ jobs:
7882
- name: Set up Go 1.17
7983
uses: actions/setup-go@v2
8084
with:
81-
go-version: 1.17.6
85+
go-version: 1.17.8
86+
87+
- name: Disable default go problem matcher
88+
run: echo "::remove-matcher owner=go::"
8289

8390
- name: Check out code into the Go module directory
8491
uses: actions/checkout@v2
@@ -95,11 +102,11 @@ jobs:
95102

96103
- name: Quality Gate - Test coverage shall be above threshold
97104
env:
98-
TESTCOVERAGE_THRESHOLD: 70
105+
TESTCOVERAGE_THRESHOLD: 50
99106
run: |
100107
echo "Quality Gate: checking test coverage is above threshold ..."
101108
echo "Threshold : $TESTCOVERAGE_THRESHOLD %"
102-
totalCoverage=`go tool cover -func=cover.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
109+
totalCoverage=`UNIT_TEST='true' go tool cover -func=cover.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
103110
echo "Current test coverage : $totalCoverage %"
104111
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
105112
echo "OK"
@@ -120,8 +127,11 @@ jobs:
120127
- name: Set up Go 1.17
121128
uses: actions/setup-go@v2
122129
with:
123-
go-version: 1.17.6
130+
go-version: 1.17.8
124131

132+
- name: Disable default go problem matcher
133+
run: echo "::remove-matcher owner=go::"
134+
125135
- name: Check out code into the Go module directory
126136
uses: actions/checkout@v2
127137
with:
@@ -145,7 +155,7 @@ jobs:
145155
path: cnf-certification-test-partner
146156

147157
- name: Start the minikube cluster for `local-test-infra`
148-
uses: ./cnf-certification-test-partner/.github/actions/start-minikube
158+
uses: ./cnf-certification-test-partner/.github/actions/start-k8s-cluster
149159
with:
150160
working_directory: cnf-certification-test-partner
151161

@@ -190,11 +200,6 @@ jobs:
190200

191201
- name: 'Test: Run without any TS, just get diagnostic information'
192202
run: ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }}
193-
194-
- name: Delete the deployment and deploy Statefulset pods
195-
uses: ./cnf-certification-test-partner/.github/actions/deploy-statefulset-pods
196-
with:
197-
working_directory: cnf-certification-test-partner
198203

199204
- name: 'Test: Run generic test suite in a TNF container'
200205
run: ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -f access-control lifecycle platform observability networking affiliated-certification operator

.github/workflows/tnf-image.yaml

+35-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ env:
3030
PARTNER_REPO: test-network-function/cnf-certification-test-partner
3131
PARTNER_SRC_URL: 'https://github.com/${PARTNER_REPO}'
3232
TESTING_CMD_PARAMS: '-n host -i ${REGISTRY_LOCAL}/${IMAGE_NAME}:${IMAGE_TAG} -t ${TNF_CONFIG_DIR} -o ${TNF_OUTPUT_DIR}'
33+
LATEST_BRANCH_VERSION: 3.3.x
3334

3435
jobs:
3536
test-and-push-tnf-image:
3637
name: 'Test and push the `test-network-function` image'
3738
runs-on: ubuntu-20.04
3839
strategy:
40+
fail-fast: false
3941
matrix:
40-
branch: [3.1.x, 3.2.x]
42+
branch: [3.1.x, 3.2.x, 3.3.x]
4143
env:
4244
SHELL: /bin/bash
4345
KUBECONFIG: '/home/runner/.kube/config'
@@ -124,10 +126,33 @@ jobs:
124126
repository: test-network-function/cnf-certification-test-partner
125127
path: cnf-certification-test-partner
126128
ref: ${{ env.PARTNER_VERSION }}
127-
129+
130+
# Only one of the following 2 steps will work depending on the repo version
131+
132+
# For versions > 3.3.0
133+
134+
- name: Check for start-k8s-cluster existence
135+
id: check_start_k8s_cluster
136+
uses: andstor/file-existence-action@v1
137+
with:
138+
files: "./cnf-certification-test-partner/.github/actions/start-k8s-cluster"
139+
140+
- name: Start the k8s cluster for `local-test-infra`
141+
if: steps.check_start_k8s_cluster.outputs.files_exists == 'true'
142+
uses: ./cnf-certification-test-partner/.github/actions/start-k8s-cluster
143+
144+
# For version <= 3.3.0
145+
146+
- name: Check for start-minikube existence
147+
id: check_start_minikube
148+
uses: andstor/file-existence-action@v1
149+
with:
150+
files: "./cnf-certification-test-partner/.github/actions/start-minikube"
151+
128152
- name: Start the minikube cluster for `local-test-infra`
153+
if: steps.check_start_minikube.outputs.files_exists == 'true'
129154
uses: ./cnf-certification-test-partner/.github/actions/start-minikube
130-
155+
131156
- name: Create `local-test-infra` OpenShift resources
132157
uses: ./cnf-certification-test-partner/.github/actions/create-local-test-infra-resources
133158
with:
@@ -142,7 +167,7 @@ jobs:
142167
shell: bash
143168

144169
- name: 'Test: Run without any TS, just get diagnostic information'
145-
run: ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }}
170+
run: ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -f diagnostic
146171

147172
# Push the new TNF image to Quay.io.
148173

@@ -156,4 +181,9 @@ jobs:
156181
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
157182

158183
- name: Push the newly built image to Quay.io
159-
run: docker push --all-tags ${REGISTRY}/${IMAGE_NAME}
184+
run: |
185+
docker push ${REGISTRY}/${IMAGE_NAME}:${TNF_VERSION}
186+
if [ "$CURRENT_VERSION_GENERIC_BRANCH" == "$LATEST_BRANCH_VERSION" ]; then
187+
docker push ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}
188+
fi
189+

CATALOG.md

+72
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ Description|http://test-network-function.com/testcases/affiliated-certification/
9898
Result Type|normative
9999
Suggested Remediation|Ensure that your container has passed the Red Hat Container Certification Program (CCP).
100100
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.3.7
101+
#### helmchart-is-certified
102+
103+
Property|Description
104+
---|---
105+
Test Case Name|helmchart-is-certified
106+
Test Case Label|affiliated-certification-helmchart-is-certified
107+
Unique ID|http://test-network-function.com/testcases/affiliated-certification/helmchart-is-certified
108+
Version|v1.0.0
109+
Description|http://test-network-function.com/testcases/affiliated-certification/helmchart-is-certified tests whether helm charts listed in the cluster passed the Red Hat Helm Certification Program.
110+
Result Type|normative
111+
Suggested Remediation|Ensure that the helm charts under test passed the Red Hat's helm Certification Program (e.g. listed in https://charts.openshift.io/index.yaml).
112+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2.12 and Section 6.3.3
101113
#### operator-is-certified
102114

103115
Property|Description
@@ -149,6 +161,18 @@ Description|http://test-network-function.com/testcases/lifecycle/image-pull-poli
149161
Result Type|normative
150162
Suggested Remediation|Ensure that the containers under test are using IfNotPresent as Image Pull Policy.
151163
Best Practice Reference|https://docs.google.com/document/d/1wRHMk1ZYUSVmgp_4kxvqjVOKwolsZ5hDXjr5MLy-wbg/edit# Section 15.6
164+
#### liveness
165+
166+
Property|Description
167+
---|---
168+
Test Case Name|liveness
169+
Test Case Label|lifecycle-liveness
170+
Unique ID|http://test-network-function.com/testcases/lifecycle/liveness
171+
Version|v1.0.0
172+
Description|http://test-network-function.com/testcases/lifecycle/liveness Checks that all pods under test have a liveness probe defined.
173+
Result Type|normative
174+
Suggested Remediation|Ensure that all CNF's pods under test have a liveness probe defined.
175+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
152176
#### pod-high-availability
153177

154178
Property|Description
@@ -209,6 +233,18 @@ Description|http://test-network-function.com/testcases/lifecycle/pod-termination
209233
Result Type|informative
210234
Suggested Remediation|Choose a terminationGracePeriod that is appropriate for your given CNF. If the default (30s) is appropriate, then feel free to ignore this informative message. This test is meant to raise awareness around how Pods are terminated, and to suggest that a CNF is configured based on its requirements. In addition to a terminationGracePeriod, consider utilizing a termination hook in the case that your application requires special shutdown instructions.
211235
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
236+
#### readiness
237+
238+
Property|Description
239+
---|---
240+
Test Case Name|readiness
241+
Test Case Label|lifecycle-readiness
242+
Unique ID|http://test-network-function.com/testcases/lifecycle/readiness
243+
Version|v1.0.0
244+
Description|http://test-network-function.com/testcases/lifecycle/readiness Checks that all pods under test have a readiness probe defined.
245+
Result Type|normative
246+
Suggested Remediation|Ensure that all CNF's pods under test have a readiness probe defined.
247+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
212248
#### statefulset-scaling
213249

214250
Property|Description
@@ -248,6 +284,30 @@ Description|http://test-network-function.com/testcases/networking/icmpv4-connect
248284
Result Type|normative
249285
Suggested Remediation|Ensure that the CNF is able to communicate via the Multus network(s). In some rare cases, CNFs may require routing table changes in order to communicate over the Multus network(s). To exclude a particular pod from ICMPv4 connectivity tests, add the test-network-function.com/skip_connectivity_tests label to it. The label value is not important, only its presence.
250286
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
287+
#### icmpv6-connectivity
288+
289+
Property|Description
290+
---|---
291+
Test Case Name|icmpv6-connectivity
292+
Test Case Label|networking-icmpv6-connectivity
293+
Unique ID|http://test-network-function.com/testcases/networking/icmpv6-connectivity
294+
Version|v1.0.0
295+
Description|http://test-network-function.com/testcases/networking/icmpv6-connectivity checks that each CNF Container is able to communicate via ICMPv6 on the Default OpenShift network. This test case requires the Deployment of the debug daemonset.
296+
Result Type|normative
297+
Suggested Remediation|Ensure that the CNF is able to communicate via the Default OpenShift network. In some rare cases, CNFs may require routing table changes in order to communicate over the Default network. To exclude a particular pod from ICMPv6 connectivity tests, add the test-network-function.com/skip_connectivity_tests label to it. The label value is not important, only its presence.
298+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
299+
#### icmpv6-connectivity-multus
300+
301+
Property|Description
302+
---|---
303+
Test Case Name|icmpv6-connectivity-multus
304+
Test Case Label|networking-icmpv6-connectivity-multus
305+
Unique ID|http://test-network-function.com/testcases/networking/icmpv6-connectivity-multus
306+
Version|v1.0.0
307+
Description|http://test-network-function.com/testcases/networking/icmpv6-connectivity-multus checks that each CNF Container is able to communicate via ICMPv6 on the Multus network(s). This test case requires the Deployment of the debug daemonset.
308+
Result Type|normative
309+
Suggested Remediation|Ensure that the CNF is able to communicate via the Multus network(s). In some rare cases, CNFs may require routing table changes in order to communicate over the Multus network(s). To exclude a particular pod from ICMPv6 connectivity tests, add the test-network-function.com/skip_connectivity_tests label to it.The label value is not important, only its presence.
310+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.2
251311
#### service-type
252312

253313
Property|Description
@@ -260,6 +320,18 @@ Description|http://test-network-function.com/testcases/networking/service-type t
260320
Result Type|normative
261321
Suggested Remediation|Ensure Services are not configured to use NodePort(s).
262322
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 6.3.1
323+
#### undeclared-container-ports-usage
324+
325+
Property|Description
326+
---|---
327+
Test Case Name|undeclared-container-ports-usage
328+
Test Case Label|networking-undeclared-container-ports-usage
329+
Unique ID|http://test-network-function.com/testcases/networking/undeclared-container-ports-usage
330+
Version|v1.0.0
331+
Description|http://test-network-function.com/testcases/networking/undeclared-container-ports-usage check that containers don't listen on ports that weren't declared in their specification
332+
Result Type|normative
333+
Suggested Remediation|ensure the CNF apps don't listen on undeclared containers' ports
334+
Best Practice Reference|[CNF Best Practice V1.2](https://connect.redhat.com/sites/default/files/2021-03/Cloud%20Native%20Network%20Function%20Requirements.pdf) Section 16.3.1.1
263335

264336
### observability
265337

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ ENV TEMP_DIR=/tmp
1313

1414
# Install dependencies
1515
RUN yum install -y gcc git jq make wget
16-
16+
RUN wget https://get.helm.sh/helm-v3.8.1-linux-amd64.tar.gz && \
17+
tar -xvf helm-v3.8.1-linux-amd64.tar.gz && \
18+
cp linux-amd64/helm /usr/bin/helm
1719
# Install Go binary
1820
ENV GO_DL_URL="https://golang.org/dl"
19-
ENV GO_BIN_TAR="go1.17.6.linux-amd64.tar.gz"
21+
ENV GO_BIN_TAR="go1.17.8.linux-amd64.tar.gz"
2022
ENV GO_BIN_URL_x86_64=${GO_DL_URL}/${GO_BIN_TAR}
2123
ENV GOPATH="/root/go"
2224
RUN if [[ "$(uname -m)" -eq "x86_64" ]] ; then \
@@ -41,7 +43,7 @@ ENV PATH=${PATH}:"/usr/local/go/bin":${GOPATH}/"bin"
4143

4244
# Git identifier to checkout
4345
ARG TNF_VERSION
44-
ARG TNF_SRC_URL=https://github.com/test-network-function/test-network-function
46+
ARG TNF_SRC_URL=$TNF_SRC_URL
4547
ARG GIT_CHECKOUT_TARGET=$TNF_VERSION
4648

4749
# Git identifier to checkout for partner

Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ COMMON_GO_ARGS=-race
4747
GIT_COMMIT=$(shell git rev-list -1 HEAD)
4848
GIT_RELEASE=$(shell git tag --points-at HEAD | head -n 1)
4949
GIT_PREVIOUS_RELEASE=$(shell git tag --no-contains HEAD --sort=v:refname | tail -n 1)
50-
GOLANGCI_VERSION=v1.44.0
50+
GOLANGCI_VERSION=v1.44.2
5151

5252
# Run the unit tests and build all binaries
5353
build:
@@ -78,8 +78,7 @@ lint:
7878
# Build and run unit tests
7979
test: mocks
8080
go build ${COMMON_GO_ARGS} ./...
81-
go test -coverprofile=cover.out -covermode count `go list ./... | grep -v "github.com/test-network-function/test-network-function/test-network-function" | grep -v mock`
82-
go tool cover -func cover.out
81+
UNIT_TEST="true" go test -coverprofile=cover.out ./...
8382

8483
coverage-html: test
8584
go tool cover -html cover.out
@@ -126,10 +125,13 @@ update-deps:
126125

127126
# Install build tools and other required software.
128127
install-tools:
129-
go install github.com/onsi/ginkgo/v2/[email protected].1
128+
go install github.com/onsi/ginkgo/v2/[email protected].3
130129
go install github.com/onsi/gomega
131130
go install github.com/golang/mock/[email protected]
132-
131+
wget https://get.helm.sh/helm-v3.8.1-linux-amd64.tar.gz && \
132+
tar -xvf helm-v3.8.1-linux-amd64.tar.gz && \
133+
cp linux-amd64/helm /usr/local/bin/helm
134+
133135
# Install golangci-lint
134136
install-lint:
135137
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GO_PATH}/bin ${GOLANGCI_VERSION}

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ At a minimum, the following dependencies must be installed *prior* to running `m
227227
Dependency|Minimum Version
228228
---|---
229229
[GoLang](https://golang.org/dl/)|1.17
230-
[golangci-lint](https://golangci-lint.run/usage/install/)|1.44.0
230+
[golangci-lint](https://golangci-lint.run/usage/install/)|1.44.2
231231
[jq](https://stedolan.github.io/jq/)|1.6
232232
[OpenShift Client](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)|4.7
233233

@@ -550,4 +550,7 @@ TNF_DEFAULT_BUFFER_SIZE=32768 ./run-cnf-suites.sh -f networking
550550
to test if operator certified need to label it with this command
551551
```shell script
552552
oc label csv <name> -n <namespace> "test-network-function.com/operator=target"
553-
```
553+
```
554+
# Testing certified helm charts
555+
to test if the helm chart is certified its need to be deployed under the namespace that are under test.
556+
if there is a need to skip a spisific helm need to add his name into the tnf_config.

go.mod

+9-5
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ require (
1111
github.com/golang/mock v1.6.0
1212
github.com/google/goexpect v0.0.0-20210330220015-096e5d1cbd97
1313
github.com/google/goterm v0.0.0-20190703233501-fc88cf888a3f
14-
github.com/kr/pretty v0.2.1 // indirect
15-
github.com/onsi/ginkgo/v2 v2.1.1
14+
github.com/onsi/ginkgo/v2 v2.1.3
1615
github.com/onsi/gomega v1.18.1
1716
github.com/sirupsen/logrus v1.8.1
18-
github.com/spf13/cobra v1.3.0
19-
github.com/stretchr/testify v1.7.0
17+
github.com/spf13/cobra v1.4.0
18+
github.com/stretchr/testify v1.7.1
2019
github.com/test-network-function/test-network-function-claim v1.0.5
2120
github.com/xeipuuv/gojsonschema v1.2.0
2221
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
23-
google.golang.org/grpc v1.44.0
22+
google.golang.org/grpc v1.45.0
2423
gopkg.in/yaml.v2 v2.4.0
2524
)
2625

26+
require (
27+
github.com/go-yaml/yaml v2.1.0+incompatible
28+
github.com/hashicorp/go-version v1.4.0
29+
)
30+
2731
require (
2832
github.com/davecgh/go-spew v1.1.1 // indirect
2933
github.com/golang/protobuf v1.5.2 // indirect

0 commit comments

Comments
 (0)