Skip to content

Commit

Permalink
Update dependencies and gofmt code
Browse files Browse the repository at this point in the history
- Update all (transitive) Go dependencies
- Update GitHub Actions
- gofmt code, as also tested by GitHub Actions
  • Loading branch information
oxzi committed Dec 19, 2023
1 parent 9600081 commit 07586db
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 940 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.16'
go-version: stable
- name: go fmt
run: test -z "$(gofmt -d . | tee /dev/stderr)"

vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.16'
go-version: stable
- name: go vet
run: go vet ./...

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.16'
go-version: stable
- name: go test
run: go test ./...
45 changes: 27 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@ go 1.16

require (
github.com/Icinga/go-libs v0.0.0-20220420130327-ef58ad52edd8
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/containerd v1.5.5 // indirect
github.com/docker/docker v20.10.8+incompatible
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/go-redis/redis/v8 v8.11.3
github.com/go-sql-driver/mysql v1.6.0
github.com/gorilla/mux v1.8.0 // indirect
github.com/lib/pq v1.10.4
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-redis/redis/v8 v8.11.5
github.com/go-sql-driver/mysql v1.7.1
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/stretchr/testify v1.7.0
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.0
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20210824181836-a4879c3d0e89 // indirect
github.com/onsi/gomega v1.24.2 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/stretchr/testify v1.8.4
go.uber.org/goleak v1.2.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0
golang.org/x/sync v0.5.0
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gotest.tools/v3 v3.5.0 // indirect
)
1,054 changes: 165 additions & 889 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/services/icinga2/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (i *dockerCreator) CreateIcinga2(name string) services.Icinga2Base {
func (i *dockerCreator) Cleanup() {
i.runningMutex.Lock()
nodes := make([]*dockerInstance, 0, len(i.running))
for n, _ := range i.running {
for n := range i.running {
nodes = append(nodes, n)
}
i.runningMutex.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion internal/services/icingadb/docker_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (i *dockerBinaryCreator) CreateIcingaDb(
func (i *dockerBinaryCreator) Cleanup() {
i.runningMutex.Lock()
instances := make([]*dockerBinaryInstance, 0, len(i.running))
for inst, _ := range i.running {
for inst := range i.running {
instances = append(instances, inst)
}
i.runningMutex.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion internal/services/redis/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (r *dockerCreator) CreateRedisServer() services.RedisServerBase {
func (r *dockerCreator) Cleanup() {
r.runningMutex.Lock()
servers := make([]*dockerServer, 0, len(r.running))
for s, _ := range r.running {
for s := range r.running {
servers = append(servers, s)
}
r.runningMutex.Unlock()
Expand Down
30 changes: 15 additions & 15 deletions it.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
// the Docker API to start and stop containers locally as required by the tests.
//
// The following environment variables are used by icinga-testing:
// - ICINGA_TESTING_ICINGA2_IMAGE: Icinga 2 container image to use (default: "icinga/icinga2:master")
// - ICINGA_TESTING_MYSQL_IMAGE: MySQL/MariaDB container image to use (default: "mysql:latest")
// - ICINGA_TESTING_PGSQL_IMAGE: PostgreSQL container image to use (default: "postgres:latest")
// - ICINGA_TESTING_REDIS_IMAGE: Redis container image to use (default: "redis:latest")
// - ICINGA_TESTING_REDIS_MONITOR: If set to "1", log all Redis commands to the debug log using redis-cli monitor
// - ICINGA_TESTING_ICINGADB_BINARY: Path to the Icinga DB binary to test. It will run in a container and therefore
// must be compiled using CGO_ENABLED=0
// - ICINGA_TESTING_ICINGADB_SCHEMA_MYSQL: Path to the full Icinga DB schema file for MySQL/MariaDB
// - ICINGA_TESTING_ICINGADB_SCHEMA_PGSQL: Path to the full Icinga DB schema file for PostgreSQL
// - ICINGA_TESTING_ICINGA2_IMAGE: Icinga 2 container image to use (default: "icinga/icinga2:master")
// - ICINGA_TESTING_MYSQL_IMAGE: MySQL/MariaDB container image to use (default: "mysql:latest")
// - ICINGA_TESTING_PGSQL_IMAGE: PostgreSQL container image to use (default: "postgres:latest")
// - ICINGA_TESTING_REDIS_IMAGE: Redis container image to use (default: "redis:latest")
// - ICINGA_TESTING_REDIS_MONITOR: If set to "1", log all Redis commands to the debug log using redis-cli monitor
// - ICINGA_TESTING_ICINGADB_BINARY: Path to the Icinga DB binary to test. It will run in a container and therefore
// must be compiled using CGO_ENABLED=0
// - ICINGA_TESTING_ICINGADB_SCHEMA_MYSQL: Path to the full Icinga DB schema file for MySQL/MariaDB
// - ICINGA_TESTING_ICINGADB_SCHEMA_PGSQL: Path to the full Icinga DB schema file for PostgreSQL
package icingatesting

import (
Expand Down Expand Up @@ -41,14 +41,14 @@ import (
// The intended use is to create a global variable of type *IT in the test package and then initialize it in TestMain
// to allow the individual Test* functions to make use of it to dynamically start services as required:
//
// var it *icingatesting.IT
// var it *icingatesting.IT
//
// func TestMain(m *testing.M) {
// it = icingatesting.NewIT()
// defer it.Cleanup()
// func TestMain(m *testing.M) {
// it = icingatesting.NewIT()
// defer it.Cleanup()
//
// m.Run()
// }
// m.Run()
// }
type IT struct {
mutex sync.Mutex
deferredCleanup []func()
Expand Down
3 changes: 1 addition & 2 deletions utils/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ type DB interface {
//
// Example usage:
//
// t.Log(utils.MustT(t).String(utils.PrettySelect(db, "SELECT * FROM somewhere")))
//
// t.Log(utils.MustT(t).String(utils.PrettySelect(db, "SELECT * FROM somewhere")))
func PrettySelect(db DB, query string, args ...interface{}) (string, error) {
cursor, err := db.Query(query, args...)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions utils/variants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func TestMakeVariantsAsBaseTypeSlice(t *testing.T) {

want := []T{
// Base
T{},
{},

// A: {23, 42}
T{A: 23},
T{A: 42},
{A: 23},
{A: 42},

// B: {1337}
T{B: 1337},
{B: 1337},
}

if !reflect.DeepEqual(got, want) {
Expand Down

0 comments on commit 07586db

Please sign in to comment.