Skip to content

Commit

Permalink
Update GolangCI-lint to v1.55.1 (#1575)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 authored Nov 1, 2023
1 parent 7bfc20a commit 54f22b2
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
version: v1.55
args: --timeout 10m0s

- name: Checkmake
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ issues:
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.54.x # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.55.x # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ GIT_COMMIT=$(shell script/create-version-files.sh)
GIT_RELEASE=$(shell script/get-git-release.sh)
GIT_PREVIOUS_RELEASE=$(shell script/get-git-previous-release.sh)
CLAIM_FORMAT_VERSION=$(shell script/get-claim-version.sh)
GOLANGCI_VERSION=v1.54.2
GOLANGCI_VERSION=v1.55.1
LINKER_TNF_RELEASE_FLAGS=-X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitCommit=${GIT_COMMIT}
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitRelease=${GIT_RELEASE}
LINKER_TNF_RELEASE_FLAGS+= -X github.com/test-network-function/cnf-certification-test/cnf-certification-test.GitPreviousRelease=${GIT_PREVIOUS_RELEASE}
Expand Down
14 changes: 9 additions & 5 deletions cnf-certification-test/identifiers/identifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const (
TagPreflight = "preflight"
)

const (
NotApplicableSNO = ` Not applicable to SNO applications.`
)

func init() {
InitCatalog()
}
Expand Down Expand Up @@ -925,7 +929,7 @@ tag. (2) It does not have any of the following prefixes: default, openshift-, is
common.LifecycleTestKey,
`Ensures that CNF Pods specify podAntiAffinity rules and replica value is set to more than 1.`,
PodHighAvailabilityBestPracticesRemediation,
NoDocumentedProcess+` Not applicable to SNO applications.`,
NoDocumentedProcess+NotApplicableSNO,
TestPodHighAvailabilityBestPracticesDocLink,
true,
map[string]string{
Expand Down Expand Up @@ -973,7 +977,7 @@ tag. (2) It does not have any of the following prefixes: default, openshift-, is
common.LifecycleTestKey,
`Tests that CNF deployments support scale in/out operations. First, the test starts getting the current replicaCount (N) of the deployment/s with the Pod Under Test. Then, it executes the scale-in oc command for (N-1) replicas. Lastly, it executes the scale-out oc command, restoring the original replicaCount of the deployment/s. In case of deployments that are managed by HPA the test is changing the min and max value to deployment Replica - 1 during scale-in and the original replicaCount again for both min/max during the scale-out stage. Lastly its restoring the original min/max replica of the deployment/s`, //nolint:lll
DeploymentScalingRemediation,
NoDocumentedProcess+` Not applicable to SNO applications.`,
NoDocumentedProcess+NotApplicableSNO,
TestDeploymentScalingIdentifierDocLink,
true,
map[string]string{
Expand All @@ -989,7 +993,7 @@ tag. (2) It does not have any of the following prefixes: default, openshift-, is
common.LifecycleTestKey,
`Tests that CNF statefulsets support scale in/out operations. First, the test starts getting the current replicaCount (N) of the statefulset/s with the Pod Under Test. Then, it executes the scale-in oc command for (N-1) replicas. Lastly, it executes the scale-out oc command, restoring the original replicaCount of the statefulset/s. In case of statefulsets that are managed by HPA the test is changing the min and max value to statefulset Replica - 1 during scale-in and the original replicaCount again for both min/max during the scale-out stage. Lastly its restoring the original min/max replica of the statefulset/s`, //nolint:lll
StatefulSetScalingRemediation,
NoDocumentedProcess+` Not applicable to SNO applications.`,
NoDocumentedProcess+NotApplicableSNO,
TestStateFulSetScalingIdentifierDocLink,
true,
map[string]string{
Expand Down Expand Up @@ -1357,7 +1361,7 @@ tag. (2) It does not have any of the following prefixes: default, openshift-, is
common.AccessControlTestKey,
`Check that all containers under test have only one process running`,
OneProcessPerContainerRemediation,
NoExceptionProcessForExtendedTests+` Not applicable to SNO applications.`,
NoExceptionProcessForExtendedTests+NotApplicableSNO,
TestOneProcessPerContainerIdentifierDocLink,
true,
map[string]string{
Expand Down Expand Up @@ -1549,7 +1553,7 @@ tag. (2) It does not have any of the following prefixes: default, openshift-, is
common.LifecycleTestKey,
`Tests that CNF crd support scale in/out operations. First, the test starts getting the current replicaCount (N) of the crd/s with the Pod Under Test. Then, it executes the scale-in oc command for (N-1) replicas. Lastly, it executes the scale-out oc command, restoring the original replicaCount of the crd/s. In case of crd that are managed by HPA the test is changing the min and max value to crd Replica - 1 during scale-in and the original replicaCount again for both min/max during the scale-out stage. Lastly its restoring the original min/max replica of the crd/s`, //nolint:lll
CrdScalingRemediation,
NoDocumentedProcess+` Not applicable to SNO applications.`,
NoDocumentedProcess+NotApplicableSNO,
TestCrdScalingIdentifierDocLink,
true,
map[string]string{
Expand Down
8 changes: 4 additions & 4 deletions cnf-certification-test/platform/cnffsdiff/fsdiff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
. "github.com/test-network-function/cnf-certification-test/cnf-certification-test/platform/cnffsdiff"
"github.com/test-network-function/cnf-certification-test/cnf-certification-test/platform/cnffsdiff"
"github.com/test-network-function/cnf-certification-test/internal/clientsholder"
"github.com/test-network-function/cnf-certification-test/pkg/testhelper"
)
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestRunTest(t *testing.T) {
err: tc.clientErr,
}

fsdiff := NewFsDiffTester(chm, clientsholder.Context{})
fsdiff := cnffsdiff.NewFsDiffTester(chm, clientsholder.Context{})
fsdiff.RunTest("fakeUID")
assert.Equal(t, tc.expectedResult, fsdiff.GetResults())
}
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestRunTestMountFolderErrors(t *testing.T) {
}

for _, tc := range testCases {
fsdiff := NewFsDiffTester(tc.mockedClientshHolder, clientsholder.Context{})
fsdiff := cnffsdiff.NewFsDiffTester(tc.mockedClientshHolder, clientsholder.Context{})
fsdiff.RunTest("fakeUID")
assert.Equal(t, testhelper.ERROR, fsdiff.GetResults())
assert.Equal(t, fsdiff.Error.Error(), tc.expectedError)
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestRunTestUnmountFolderErrors(t *testing.T) {
}

for _, tc := range testCases {
fsdiff := NewFsDiffTester(tc.mockedClientshHolder, clientsholder.Context{})
fsdiff := cnffsdiff.NewFsDiffTester(tc.mockedClientshHolder, clientsholder.Context{})
fsdiff.RunTest("fakeUID")
assert.Equal(t, testhelper.ERROR, fsdiff.GetResults())
assert.Equal(t, fsdiff.Error.Error(), tc.expectedError)
Expand Down
2 changes: 1 addition & 1 deletion docs/test-standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ make install-tools
Dependency|Minimum Version
---|---
[GoLang](https://golang.org/dl/)|1.21
[golangci-lint](https://golangci-lint.run/usage/install/)|1.54.2
[golangci-lint](https://golangci-lint.run/usage/install/)|1.55.1
[jq](https://stedolan.github.io/jq/)|1.6
[OpenShift Client](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)|4.12

Expand Down
11 changes: 8 additions & 3 deletions internal/crclient/crclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ type Process struct {
Args string
}

const (
DevNull = " 2>/dev/null"
DockerInspectPID = "chroot /host docker inspect -f '{{.State.Pid}}' "
)

// Helper function to create the clientsholder.Context of the first container of the debug pod
// that runs in the give node. This context is usually needed to run shell commands that get
// information from a node where a pod/container under test is running.
Expand All @@ -51,11 +56,11 @@ func GetPidFromContainer(cut *provider.Container, ctx clientsholder.Context) (in

switch cut.Runtime {
case "docker":
pidCmd = "chroot /host docker inspect -f '{{.State.Pid}}' " + cut.UID + " 2>/dev/null"
pidCmd = DockerInspectPID + cut.UID + DevNull
case "docker-pullable":
pidCmd = "chroot /host docker inspect -f '{{.State.Pid}}' " + cut.UID + " 2>/dev/null"
pidCmd = DockerInspectPID + cut.UID + DevNull
case "cri-o", "containerd":
pidCmd = "chroot /host crictl inspect --output go-template --template '{{.info.pid}}' " + cut.UID + " 2>/dev/null"
pidCmd = "chroot /host crictl inspect --output go-template --template '{{.info.pid}}' " + cut.UID + DevNull
default:
logrus.Debugf("Container runtime %s not supported yet for this test, skipping", cut.Runtime)
return 0, fmt.Errorf("container runtime %s not supported", cut.Runtime)
Expand Down
3 changes: 1 addition & 2 deletions pkg/scheduling/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const (
CurrentSchedulingPriority = "current scheduling priority"
newLineCharacter = "\n"

SharedCPUScheduling = "SHARED_CPU_SCHEDULING"
//nolint:gosec
SharedCPUScheduling = "SHARED_CPU_SCHEDULING"
ExclusiveCPUScheduling = "EXCLUSIVE_CPU_SCHEDULING"
IsolatedCPUScheduling = "ISOLATED_CPU_SCHEDULING"

Expand Down

0 comments on commit 54f22b2

Please sign in to comment.