Skip to content

Commit

Permalink
NOISSUE - Update dependencies (#2061)
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
  • Loading branch information
dborovcanin authored Jan 23, 2024
1 parent d95283d commit 79ef28a
Show file tree
Hide file tree
Showing 49 changed files with 418 additions and 833 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Check License Header
run: |
CHECK=$(grep -rcL --exclude-dir={.git,build} \
CHECK=$(grep -rcL --exclude-dir={.git,build,**vernemq**} \
--exclude=\*.{crt,key,pem,zed,hcl,md,json,csv,mod,sum,tmpl,args} \
--exclude={CODEOWNERS,LICENSE,MAINTAINERS} \
--regexp "Copyright (c) Abstract Machines" .)
Expand Down
20 changes: 14 additions & 6 deletions auth/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/absmach/magistrala/internal/postgres"
"github.com/jmoiron/sqlx"
dockertest "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
"go.opentelemetry.io/otel"
)

Expand All @@ -33,12 +34,19 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("postgres", "13.3-alpine", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "postgres",
Tag: "16.1-alpine",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
log.Fatalf("Could not start container: %s", err)
}
Expand Down
9 changes: 8 additions & 1 deletion bootstrap/events/producer/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/go-redis/redis/v8"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var (
Expand All @@ -25,7 +26,13 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

container, err := pool.Run("redis", "7.2.0-alpine", nil)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "redis",
Tag: "7.2.4-alpine",
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
log.Fatalf("Could not start container: %s", err)
}
Expand Down
23 changes: 16 additions & 7 deletions bootstrap/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package postgres_test

import (
"fmt"
"log"
"os"
"testing"

Expand All @@ -13,6 +14,7 @@ import (
mglog "github.com/absmach/magistrala/logger"
"github.com/jmoiron/sqlx"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var (
Expand All @@ -26,14 +28,21 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("postgres", "13.3-alpine", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "postgres",
Tag: "16.1-alpine",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
testLog.Error(fmt.Sprintf("Could not start container: %s", err))
log.Fatalf("Could not start container: %s", err)
}

port := container.GetPort("5432/tcp")
Expand Down
23 changes: 16 additions & 7 deletions certs/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package postgres_test
import (
"database/sql"
"fmt"
"log"
"os"
"testing"

Expand All @@ -14,6 +15,7 @@ import (
mglog "github.com/absmach/magistrala/logger"
"github.com/jmoiron/sqlx"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var (
Expand All @@ -28,14 +30,21 @@ func TestMain(m *testing.M) {
return
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("postgres", "13.3-alpine", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "postgres",
Tag: "16.1-alpine",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
testLog.Error(fmt.Sprintf("Could not start container: %s", err))
log.Fatalf("Could not start container: %s", err)
}

port := container.GetPort("5432/tcp")
Expand Down
20 changes: 14 additions & 6 deletions consumers/notifiers/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var (
Expand All @@ -30,12 +31,19 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("postgres", "13.3-alpine", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "postgres",
Tag: "16.1-alpine",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
log.Fatalf("Could not start container: %s", err)
}
Expand Down
12 changes: 10 additions & 2 deletions consumers/writers/cassandra/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ package cassandra_test

import (
"fmt"
"log"
"os"
"testing"

"github.com/absmach/magistrala/internal/clients/cassandra"
mglog "github.com/absmach/magistrala/logger"
"github.com/gocql/gocql"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var logger, _ = mglog.New(os.Stdout, "info")
Expand All @@ -22,9 +24,15 @@ func TestMain(m *testing.M) {
logger.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

container, err := pool.Run("cassandra", "3.11.10", []string{})
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "cassandra",
Tag: "3.11.16",
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
logger.Error(fmt.Sprintf("Could not start container: %s", err))
log.Fatalf("Could not start container: %s", err)
}

port := container.GetPort("9042/tcp")
Expand Down
36 changes: 21 additions & 15 deletions consumers/writers/influxdb/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

influxdata "github.com/influxdata/influxdb-client-go/v2"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

const (
Expand All @@ -27,8 +28,8 @@ const (
dbFluxEnabled = "true"
dbBindAddress = ":8088"
port = "8086/tcp"
broker = "influxdb"
brokerVersion = "2.2-alpine"
db = "influxdb"
dbVersion = "2.7-alpine"
poolMaxWait = 120 * time.Second
)

Expand All @@ -40,21 +41,26 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

cfg := []string{
fmt.Sprintf("DOCKER_INFLUXDB_INIT_MODE=%s", dbInitMode),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_USERNAME=%s", dbAdmin),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_PASSWORD=%s", dbPass),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_ORG=%s", dbOrg),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_BUCKET=%s", dbBucket),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=%s", dbToken),
fmt.Sprintf("INFLUXDB_HTTP_FLUX_ENABLED=%s", dbFluxEnabled),
fmt.Sprintf("INFLUXDB_BIND_ADDRESS=%s", dbBindAddress),
}
container, err := pool.Run(broker, brokerVersion, cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: db,
Tag: dbVersion,
Env: []string{
fmt.Sprintf("DOCKER_INFLUXDB_INIT_MODE=%s", dbInitMode),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_USERNAME=%s", dbAdmin),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_PASSWORD=%s", dbPass),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_ORG=%s", dbOrg),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_BUCKET=%s", dbBucket),
fmt.Sprintf("DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=%s", dbToken),
fmt.Sprintf("INFLUXDB_HTTP_FLUX_ENABLED=%s", dbFluxEnabled),
fmt.Sprintf("INFLUXDB_BIND_ADDRESS=%s", dbBindAddress),
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
testLog.Error(fmt.Sprintf("Could not start container: %s", err))
log.Fatalf("Could not start container: %s", err)
}

handleInterrupt(m, pool, container)

address = fmt.Sprintf("%s:%s", "http://localhost", container.GetPort(port))
Expand Down
19 changes: 13 additions & 6 deletions consumers/writers/mongodb/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ package mongodb_test
import (
"context"
"fmt"
"log"
"os"
"testing"

"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
Expand All @@ -20,13 +22,18 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

cfg := []string{
"MONGO_INITDB_DATABASE=test",
}

container, err := pool.Run("mongo", "4.4.6", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "mongo",
Tag: "7.0.5",
Env: []string{
"MONGO_INITDB_DATABASE=test",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
testLog.Error(fmt.Sprintf("Could not start container: %s", err))
log.Fatalf("Could not start container: %s", err)
}

port = container.GetPort("27017/tcp")
Expand Down
20 changes: 14 additions & 6 deletions consumers/writers/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
pgclient "github.com/absmach/magistrala/internal/clients/postgres"
"github.com/jmoiron/sqlx"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var db *sqlx.DB
Expand All @@ -25,12 +26,19 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("postgres", "13.3-alpine", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "postgres",
Tag: "16.1-alpine",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
log.Fatalf("Could not start container: %s", err)
}
Expand Down
20 changes: 14 additions & 6 deletions consumers/writers/timescale/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
pgclient "github.com/absmach/magistrala/internal/clients/postgres"
"github.com/jmoiron/sqlx"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)

var db *sqlx.DB
Expand All @@ -25,12 +26,19 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

cfg := []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
}
container, err := pool.Run("timescale/timescaledb", "2.4.0-pg12", cfg)
container, err := pool.RunWithOptions(&dockertest.RunOptions{
Repository: "timescale/timescaledb",
Tag: "2.13.1-pg16",
Env: []string{
"POSTGRES_USER=test",
"POSTGRES_PASSWORD=test",
"POSTGRES_DB=test",
"listen_addresses = '*'",
},
}, func(config *docker.HostConfig) {
config.AutoRemove = true
config.RestartPolicy = docker.RestartPolicy{Name: "no"}
})
if err != nil {
log.Fatalf("Could not start container: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion docker/addons/bootstrap/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ volumes:

services:
bootstrap-db:
image: postgres:13.3-alpine
image: postgres:16.1-alpine
container_name: magistrala-bootstrap-db
restart: on-failure
environment:
Expand Down
Loading

0 comments on commit 79ef28a

Please sign in to comment.