From 8dbaa6264d4e93946d01f4d1035f15aed39f358c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20P=C3=A9rez=20Halc=C3=B3n?= Date: Sat, 7 Dec 2024 09:45:10 +0100 Subject: [PATCH] fix(validator): tests --- .github/workflows/release.yml | 4 +++- .github/workflows/tests.yml | 9 ++++----- go.mod | 2 +- internal/logger/main.go | 12 ++++++------ internal/validator/main_test.go | 4 ++-- internal/validator/tests/test1.yaml | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 784a8b9..b9485dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,9 +16,11 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-go@v4 + - name: Set up Go + uses: actions/setup-go@v5 with: go-version: "1.23" + cache: true - name: Install GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 69d858c..17befa7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: "1.23" cache: true @@ -30,12 +30,11 @@ jobs: - name: Run unit tests run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + - name: Upload results to Codecov + uses: codecov/codecov-action@v5 with: - file: ./coverage.txt token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true + slug: jaimeph/helm-lint-kcl lint: name: Lint diff --git a/go.mod b/go.mod index 01775c4..dae3402 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jaimeph/helm-lint-kcl -go 1.23.2 +go 1.23 require ( github.com/spf13/cobra v1.8.1 diff --git a/internal/logger/main.go b/internal/logger/main.go index a25c274..9b18464 100644 --- a/internal/logger/main.go +++ b/internal/logger/main.go @@ -24,29 +24,29 @@ func SetLevelDebug(active bool) { } func Infof(message string, args ...interface{}) { - fmt.Printf(" INFO "+message+"\n", args...) + fmt.Printf(message+"\n", args...) } func Info(message string) { - fmt.Println(" INFO " + message) + fmt.Println(message) } func Debugf(message string, args ...interface{}) { if level >= LevelDebug { - fmt.Printf("DEBUG "+message+"\n", args...) + fmt.Printf(message+"\n", args...) } } func Debug(message string) { if level >= LevelDebug { - fmt.Println("DEBUG " + message) + fmt.Println(message) } } func Errorf(message string, args ...interface{}) { - fmt.Printf("ERROR "+message+"\n", args...) + fmt.Printf(message+"\n", args...) } func Error(message string) { - fmt.Println("ERROR " + message) + fmt.Println(message) } diff --git a/internal/validator/main_test.go b/internal/validator/main_test.go index 2ef7c85..fda9712 100644 --- a/internal/validator/main_test.go +++ b/internal/validator/main_test.go @@ -22,8 +22,8 @@ func TestValidate(t *testing.T) { }{ { name: "valid input", - values: LoadFileToBytes("tests/test1.k"), - schemas: LoadFileToBytes("tests/test1.yaml"), + values: LoadFileToBytes("tests/test1.yaml"), + schemas: LoadFileToBytes("tests/test1.k"), wantErr: false, }, { diff --git a/internal/validator/tests/test1.yaml b/internal/validator/tests/test1.yaml index b082103..471484c 100644 --- a/internal/validator/tests/test1.yaml +++ b/internal/validator/tests/test1.yaml @@ -1,5 +1,5 @@ podspec: - tests: + containers: mycontainer: enabled: false image: