test(config,git,logger): add some test functions

This commit is contained in:
Tom Neuber 2024-12-06 23:56:18 +01:00
parent 316e5de757
commit 1356128a7b
Signed by: tom
GPG key ID: F17EFE4272D89FF6
16 changed files with 387 additions and 25 deletions

View file

@ -1,7 +1,16 @@
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2024 Marat Reymers
## Golden config for golangci-lint v1.62.0
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt and change it for your needs.
run: run:
# Timeout for analysis, e.g. 30s, 5m. # Timeout for analysis, e.g. 30s, 5m.
# Default: 1m # Default: 1m
timeout: 5m timeout: 3m
# This file contains only configs which differ from defaults. # This file contains only configs which differ from defaults.
@ -71,6 +80,11 @@ linters-settings:
# Default false # Default false
ignore-comments: true ignore-comments: true
gochecksumtype:
# Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
# Default: true
default-signifies-exhaustive: false
gocognit: gocognit:
# Minimal code complexity to report. # Minimal code complexity to report.
# Default: 30 (but we recommend 10-20) # Default: 30 (but we recommend 10-20)
@ -218,14 +232,13 @@ linters:
- bidichk # checks for dangerous unicode character sequences - bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully - bodyclose # checks whether HTTP response body is closed successfully
- canonicalheader # checks whether net/http.Header uses canonical header - canonicalheader # checks whether net/http.Header uses canonical header
- copyloopvar # detects places where loop variables are copied - copyloopvar # detects places where loop variables are copied (Go 1.22+)
- cyclop # checks function and package cyclomatic complexity - cyclop # checks function and package cyclomatic complexity
- dupl # tool for code clone detection - dupl # tool for code clone detection
- durationcheck # checks for two durations multiplied together - durationcheck # checks for two durations multiplied together
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error - 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 - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- exhaustive # checks exhaustiveness of enum switch statements - exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- fatcontext # detects nested contexts in loops - fatcontext # detects nested contexts in loops
- forbidigo # forbids identifiers - forbidigo # forbids identifiers
- funlen # tool for detection of long functions - funlen # tool for detection of long functions
@ -243,6 +256,7 @@ linters:
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
- goprintffuncname # checks that printf-like functions are named with f at the end - goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems - gosec # inspects source code for security problems
- iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
- intrange # finds places where for loops could make use of an integer range - intrange # finds places where for loops could make use of an integer range
- lll # reports long lines - lll # reports long lines
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap) - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
@ -264,6 +278,7 @@ linters:
- promlinter # checks Prometheus metrics naming via promlint - promlinter # checks Prometheus metrics naming via promlint
- protogetter # reports direct reads from proto message fields when getters should be used - protogetter # reports direct reads from proto message fields when getters should be used
- reassign # checks that package variables are not reassigned - reassign # checks that package variables are not reassigned
- recvcheck # checks for receiver type consistency
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
- rowserrcheck # checks whether Err of rows is checked successfully - rowserrcheck # checks whether Err of rows is checked successfully
- sloglint # ensure consistent code style when using log/slog - sloglint # ensure consistent code style when using log/slog
@ -305,7 +320,7 @@ linters:
#- dupword # [useless without config] checks for duplicate words in the source code #- dupword # [useless without config] checks for duplicate words in the source code
#- err113 # [too strict] checks the errors handling expressions #- err113 # [too strict] checks the errors handling expressions
#- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
#- execinquery # [deprecated] checks query string in Query function which reads your Go src files and warning it finds #- exportloopref # [not necessary from Go 1.22] checks for pointers to enclosing loop variables
#- forcetypeassert # [replaced by errcheck] finds forced type assertions #- forcetypeassert # [replaced by errcheck] finds forced type assertions
#- gofmt # [replaced by goimports] checks whether code was gofmt-ed #- 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 #- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed
@ -335,6 +350,7 @@ issues:
linters: linters:
- bodyclose - bodyclose
- dupl - dupl
- errcheck
- funlen - funlen
- goconst - goconst
- gosec - gosec

View file

@ -38,6 +38,5 @@ steps:
exclude: main exclude: main
event: push event: push
depends_on: depends_on:
- gofmt
- lint - lint
- vulncheck - test

View file

@ -54,4 +54,6 @@ steps:
- branch: main - branch: main
event: push event: push
depends_on: depends_on:
- build - build
- lint
- test

View file

@ -1,4 +1,17 @@
steps: steps:
- name: gofmt
image: golang:1.22.5
commands:
- gofmt -l -s .
when:
- event: push
- name: vuln-check
image: golang:1.22.5
commands:
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
when:
- event: push
- name: golangci-linter - name: golangci-linter
image: golangci/golangci-lint:v1.59.1 image: golangci/golangci-lint:v1.59.1
commands: commands:

View file

@ -1,7 +1,9 @@
steps: steps:
- name: gofmt - name: gotest
image: golang:1.22.5 image: golang:1.22.5
commands: commands:
- gofmt -l -s . - go test ./...
when: when:
- event: push - event: push
depends_on:
- lint

View file

@ -1,8 +0,0 @@
steps:
- name: vuln-check
image: golang:1.22.5
commands:
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
when:
- event: push

3
go.mod
View file

@ -10,6 +10,7 @@ require (
github.com/spf13/cobra v1.8.1 github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0 github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
golang.org/x/net v0.28.0 golang.org/x/net v0.28.0
) )
@ -18,6 +19,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cloudflare/circl v1.3.9 // indirect github.com/cloudflare/circl v1.3.9 // indirect
github.com/cyphar/filepath-securejoin v0.3.1 // indirect github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emirpasic/gods v1.18.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
@ -32,6 +34,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect

View file

@ -7,6 +7,15 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )
var (
ErrInvalidGrafanaURL = errors.New("invalid grafana URL, must not be blank")
ErrInvalidAuthToken = errors.New("invalid auth token for grafana, must not be blank")
ErrInvalidRepoURL = errors.New("invalid repo url for git, must not be blank")
ErrInvalidGitUser = errors.New("invalid username for git, must not be blank")
ErrInvalidGitPass = errors.New("invalid password for git, must not be blank")
ErrInvalidBranchName = errors.New("invalid branch name for git, must not be blank")
)
type Config struct { type Config struct {
Debug bool Debug bool
ForceCommits bool ForceCommits bool
@ -29,27 +38,27 @@ func (c *Config) Validate() []error {
var errs []error var errs []error
if c.GrafanaURL == "" { if c.GrafanaURL == "" {
errs = append(errs, errors.New("invalid grafana URL, must not be blank")) errs = append(errs, ErrInvalidGrafanaURL)
} }
if c.GrafanaToken == "" { if c.GrafanaToken == "" {
errs = append(errs, errors.New("invalid auth token for grafana, must not be blank")) errs = append(errs, ErrInvalidAuthToken)
} }
if c.GitRepo == "" { if c.GitRepo == "" {
errs = append(errs, errors.New("invalid repo url for git, must not be blank")) errs = append(errs, ErrInvalidRepoURL)
} }
if c.GitUser == "" { if c.GitUser == "" {
errs = append(errs, errors.New("invalid username for git, must not be blank")) errs = append(errs, ErrInvalidGitUser)
} }
if c.GitPass == "" { if c.GitPass == "" {
errs = append(errs, errors.New("invalid password for git, must not be blank")) errs = append(errs, ErrInvalidGitPass)
} }
if c.GitBranch == "" { if c.GitBranch == "" {
errs = append(errs, errors.New("invalid branch name for git, must not be blank")) errs = append(errs, ErrInvalidBranchName)
} }
return errs return errs

View file

@ -0,0 +1,40 @@
package config_test
import (
"testing"
"git.ar21.de/yolokube/grafana-backuper/internal/config"
"github.com/stretchr/testify/assert"
)
func TestConfig_Validate_MissingFields(t *testing.T) {
cfg := config.Config{}
errs := cfg.Validate()
assert.Len(t, errs, 6) // Expecting 6 errors since all required fields are missing
}
func TestConfig_Validate_AllFieldsPresent(t *testing.T) {
cfg := config.Config{
GrafanaURL: "http://grafana.example.com",
GrafanaToken: "sometoken",
GitRepo: "https://github.com/user/repo",
GitUser: "username",
GitPass: "password",
GitBranch: "main",
}
errs := cfg.Validate()
assert.Empty(t, errs) // No errors should be returned when all fields are valid
}
func TestConfig_Validate_PartiallyPopulated(t *testing.T) {
cfg := config.Config{
GrafanaURL: "http://grafana.example.com",
GitRepo: "https://github.com/user/repo",
GitUser: "username",
}
errs := cfg.Validate()
assert.Len(t, errs, 3) // Expecting 3 errors for missing GrafanaToken, GitPass, and GitBranch
}

View file

@ -0,0 +1,49 @@
package logger_test
import (
"bytes"
"testing"
"git.ar21.de/yolokube/grafana-backuper/internal/logger"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestCliLoggerLayout_DebugLevel(t *testing.T) {
var buf bytes.Buffer
zerolog.SetGlobalLevel(zerolog.DebugLevel)
log := logger.CliLoggerLayout(&buf)
log.Debug().Msg("test message")
output := buf.String()
assert.Contains(t, output, "test message")
assert.Contains(t, output, "DBG") // Assuming zerolog adds a short level indicator like "DBG"
assert.Contains(t, output, ".go:") // Ensures the caller file and line are included
}
func TestCliLoggerLayout_NonDebugLevel(t *testing.T) {
var buf bytes.Buffer
zerolog.SetGlobalLevel(zerolog.InfoLevel)
log := logger.CliLoggerLayout(&buf)
log.Info().Msg("test message")
output := buf.String()
assert.Contains(t, output, "test message")
assert.NotContains(t, output, "DBG") // Since we're at Info level
assert.NotContains(t, output, ".go:") // Caller information should not be included
}
func TestJSONLoggerLayout(t *testing.T) {
var buf bytes.Buffer
log := logger.JSONLoggerLayout(&buf)
log.Info().Msg("test message")
output := buf.String()
assert.Contains(t, output, `"message":"test message"`)
assert.Contains(t, output, `"level":"info"`)
assert.Contains(t, output, `"time":`) // Timestamp should be included
assert.Contains(t, output, `"caller":`) // Caller should be included
}

14
pkg/git/project_test.go Normal file
View file

@ -0,0 +1,14 @@
package git_test
import (
"testing"
"git.ar21.de/yolokube/grafana-backuper/pkg/git"
"github.com/stretchr/testify/assert"
)
func TestNewProject(t *testing.T) {
project := git.NewProject("https://example.com/repo.git")
assert.NotNil(t, project)
assert.Equal(t, "https://example.com/repo.git", project.RepoURL)
}

36
pkg/git/sign_key_test.go Normal file
View file

@ -0,0 +1,36 @@
package git_test
import (
"testing"
"git.ar21.de/yolokube/grafana-backuper/pkg/git"
"github.com/stretchr/testify/assert"
)
func TestReadKeyFile_Success(t *testing.T) {
signKey := &git.SignKey{KeyFile: "testdata/test-key.asc"}
err := signKey.ReadKeyFile()
assert.NoError(t, err)
}
func TestReadKeyFile_FileError(t *testing.T) {
signKey := &git.SignKey{KeyFile: "nonexistent-file.asc"}
err := signKey.ReadKeyFile()
assert.Error(t, err)
}
func TestReadKeyFile_DecodingError(t *testing.T) {
signKey := &git.SignKey{KeyFile: "testdata/test-invalid-key.asc"}
err := signKey.ReadKeyFile()
assert.Error(t, err)
}
func TestReadKeyFile_EmptyKeyRing(t *testing.T) {
signKey := &git.SignKey{KeyFile: "testdata/test-empty-key.asc"}
err := signKey.ReadKeyFile()
assert.Error(t, err)
}

4
pkg/git/testdata/test-empty-key.asc vendored Normal file
View file

@ -0,0 +1,4 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: Keybase OpenPGP v1.0.0
Comment: https://keybase.io/crypto
-----END PGP PRIVATE KEY BLOCK-----

1
pkg/git/testdata/test-invalid-key.asc vendored Normal file
View file

@ -0,0 +1 @@
invalid content

182
pkg/git/testdata/test-key.asc vendored Normal file
View file

@ -0,0 +1,182 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: Keybase OpenPGP v1.0.0
Comment: https://keybase.io/crypto
xcaGBGbEwjQBEADOdK3XF76rKhw8no1/+AXbBSJJxq5JP0cykHyTPHhSxbkQliVF
C/dpuvtY+wzY+DRvqjvwemsfwEtJZI06ZkvIbTpWr03M1UT1EDR6HkRIczyJdUq0
TM/gmcGUBA4Xooiu9xYSLEWJrAoJdw8DSlSmNqxQYLoesU4yx4cYC7NQOqTl/eT+
fkEqSisxaOnMc1V8d5sXwYeNl+62C4BL4dn8wT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jX6pmkKct6QYZDzYdvpxCLo
X9Gbz+uRb5P1SkKjBDbD/SNWB3W0HsPZpFdtikUN/UdEIN3ZBIgKiMnhRffx+Syb
EkPTIvnCsEW65XTCwLYkLdVqNQcphwttnC0j3DluoRbaVeZFR3iN53tIm8n1uO0N
5fTapgBmwc1gGGgPhunmVXJVOAnKtvKmXWyJKBsbmFNLO8IX0759sU72fsGwFVVO
WX2+AKt5lnMtqF+b2YEjakgcaIMuZ+2VlXPAgPeH7wxl8JdJZ72joZDWnqa7cAc8
eXxEOnMeVMdt44cRwNZeT1Ic+TqRfUvJFFCFTc9daoR/O7qQbLY+47oIbex9Ffjv
pWsytOctoe93RUxV/saRti06WlW1aQdMCTINUWA30rFs3KyM09r0p1BEu0rYx9nb
YZ3g9Y8QOzszYPB450rVxLOEY6eV1Q==
=W3yz
-----END PGP PRIVATE KEY BLOCK-----

View file

@ -74,7 +74,7 @@ func (c *DashboardVersionClient) Get(
version uint, version uint,
params ...DashboardVersionParam, params ...DashboardVersionParam,
) (*DashboardVersion, *Response, error) { ) (*DashboardVersion, *Response, error) {
if id, err := strconv.Atoi(input); err == nil { if id, err := strconv.ParseUint(input, 10, 64); err == nil {
return c.GetByID(ctx, uint(id), version, params...) return c.GetByID(ctx, uint(id), version, params...)
} }
return c.GetByUID(ctx, input, version, params...) return c.GetByUID(ctx, input, version, params...)
@ -111,7 +111,7 @@ func (c *DashboardVersionClient) List(
input string, input string,
params ...DashboardVersionParam, params ...DashboardVersionParam,
) ([]*DashboardVersion, *Response, error) { ) ([]*DashboardVersion, *Response, error) {
if id, err := strconv.Atoi(input); err == nil { if id, err := strconv.ParseUint(input, 10, 64); err == nil {
return c.ListByID(ctx, uint(id), params...) return c.ListByID(ctx, uint(id), params...)
} }
return c.ListByUID(ctx, input, params...) return c.ListByUID(ctx, input, params...)