Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and gofmt code #26

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 ./...
46 changes: 28 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,34 @@ 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.6.0
golang.org/x/sys v0.16.0 // indirect
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,056 changes: 167 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