Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3518ba2
chore(tests): add linting to e2e tests
nevermarine Jul 14, 2025
73dca97
fix newline
nevermarine Jul 14, 2025
08b83d9
fix name
nevermarine Jul 14, 2025
4d837c1
remove prune path
nevermarine Jul 14, 2025
f09c0c6
fix e2e config
nevermarine Jul 14, 2025
2a60afc
handle errors
nevermarine Jul 14, 2025
2d4a9b3
update .golangci.yaml
nevermarine Jul 14, 2025
1b9c053
fix updatedVmObj & updatedVmObjC
nevermarine Jul 14, 2025
724f724
fix %s in fmt.Errorf
nevermarine Jul 14, 2025
1945282
fix insecureTls
nevermarine Jul 14, 2025
3bb2e5a
fix ApiVersion
nevermarine Jul 14, 2025
3b6c8c5
fix VmConfiguration
nevermarine Jul 14, 2025
efa416f
fix Vm* variables
nevermarine Jul 14, 2025
c6309f6
fix SshUser
nevermarine Jul 14, 2025
19f056e
fix SshOptions
nevermarine Jul 14, 2025
4275f32
fix VmConf
nevermarine Jul 14, 2025
4e4f98c
fix SshCommand
nevermarine Jul 14, 2025
6dbd68d
fix LocalSshOpts
nevermarine Jul 14, 2025
e708990
fix VmLabelAnnotation & GetFullApiResourceName
nevermarine Jul 15, 2025
f034990
golangci-lint run --fix
nevermarine Jul 15, 2025
2ac15ab
fix stylecheck dot imports error
nevermarine Jul 15, 2025
1e33c1c
disable all initials except VM and SSH
nevermarine Jul 15, 2025
413fad7
fix Vm->VM ST1003 errors by stylecheck
nevermarine Jul 15, 2025
d68ed09
fix fmt.Errorf() formatting
nevermarine Jul 15, 2025
ae3edba
replace other initialisms
nevermarine Jul 15, 2025
12b5262
Merge branch 'main' into chore/ci/add-linting-to-the-tests
nevermarine Jul 16, 2025
4a27153
golangci-lint --fix
nevermarine Jul 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions tests/e2e/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
run:
concurrency: 4
timeout: 10m
issues:
# Show all errors.
max-issues-per-linter: 0
max-same-issues: 0
exclude:
- "don't use an underscore in package name"
output:
sort-results: true

exclude-files:
- "^zz_generated.*"

linters-settings:
gofumpt:
extra-rules: true
gci:
sections:
- standard
- default
- prefix(github.com/deckhouse/)
goimports:
local-prefixes: github.com/deckhouse/
errcheck:
exclude-functions: fmt:.*,[rR]ead|[wW]rite|[cC]lose,io:Copy
revive:
rules:
- name: dot-imports
disabled: true
stylecheck:
dot-import-whitelist:
- github.com/onsi/gomega
- github.com/onsi/ginkgo/v2
- github.com/deckhouse/virtualization/tests/e2e/helper
nolintlint:
# Exclude following linters from requiring an explanation.
# Default: []
allow-no-explanation: [funlen, gocognit, lll]
# Enable to require an explanation of nonzero length after each nolint directive.
# Default: false
require-explanation: true
# Enable to require nolint directives to mention the specific linter being suppressed.
# Default: false
require-specific: true

linters:
disable-all: true
enable:
- asciicheck # checks that your code does not contain non-ASCII identifiers
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # [maby too many false positives] checks the function whether use a non-inherited context
- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
- errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- copyloopvar # detects places where loop variables are copied (Go 1.22+)
- gci # controls golang package import order and makes it always deterministic
- gocritic # provides diagnostics that check for bugs, performance and style issues
- gofmt # [replaced by goimports] checks whether code was gofmt-ed
- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gosimple # specializes in simplifying a code
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # detects when assignments to existing variables are not used
- misspell # finds commonly misspelled English words in comments
- nolintlint # reports ill-formed or insufficient nolint directives
- reassign # Checks that package variables are not reassigned.
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
- stylecheck # is a replacement for golint
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
- testifylint # checks usage of github.com/stretchr/testify
- unconvert # removes unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- usetesting # reports uses of functions with replacement inside the testing package
- testableexamples # checks if examples are testable (have an expected output)
- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
- whitespace # detects leading and trailing whitespace
- wastedassign # Finds wasted assignment statements.
25 changes: 22 additions & 3 deletions tests/e2e/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ tasks:
echo "Error: Deckhouse is not ready."
exit 1
fi
d8 k patch mpo virtualization --type merge -p "{\"spec\":{\"imageTag\":\"$v12n_tag\"}}"
d8 k patch mpo virtualization --type merge -p "{\"spec\":{\"imageTag\":\"$v12n_tag\"}}"
images_hash=$(crane export "dev-registry.deckhouse.io/sys/deckhouse-oss/modules/virtualization:$v12n_tag" - | tar -Oxf - images_digests.json)
v12n_pods=$(kubectl -n d8-virtualization get pods -o json | jq -c)
retry_count=0
max_retries=120
sleep_interval=5
sleep_interval=5

while true; do
all_hashes_found=true
Expand Down Expand Up @@ -193,7 +193,7 @@ tasks:
if [ "$all_hashes_found" = true ]; then
echo "All image hashes found in pods."
break
fi
fi

retry_count=$((retry_count + 1))
echo "Some hashes are missing, rechecking... Attempt: $retry_count"
Expand All @@ -206,3 +206,22 @@ tasks:
# Wait for the specified interval before retrying
sleep "$sleep_interval"
done

_ensure:golangci-lint:
desc: "Ensure golangci-lint is available"
internal: true
cmds:
- |
echo -e >&2 "Please install golangci-lint https://golangci-lint.run/usage/install/"
exit 1
status:
- |
[ -f ./golangci-lint ] || which golangci-lint

lint:go:
desc: "Run golangci-lint"
deps:
- _ensure:golangci-lint
cmds:
- |
golangci-lint run --sort-results
Loading
Loading