Skip to content

Commit

Permalink
MF-1378 - Update dependencies (absmach#1379)
Browse files Browse the repository at this point in the history
* Update dependencies

Signed-off-by: dusanb94 <[email protected]>

* Fix compose files and configs

Signed-off-by: dusanb94 <[email protected]>

* Upgrade image versions

Signed-off-by: dusanb94 <[email protected]>

* Update Postgres version

Signed-off-by: dusanb94 <[email protected]>

* Update test dependencies

Signed-off-by: dusanb94 <[email protected]>

* Fix fkey error handling

Signed-off-by: dusanb94 <[email protected]>
  • Loading branch information
dborovcanin authored May 20, 2021
1 parent 38ca7f7 commit 516c02b
Show file tree
Hide file tree
Showing 1,687 changed files with 108,526 additions and 44,255 deletions.
36 changes: 18 additions & 18 deletions bootstrap/api/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func addEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(addReq)
if err := req.validate(); err != nil {
return nil, err
Expand All @@ -34,7 +34,7 @@ func addEndpoint(svc bootstrap.Service) endpoint.Endpoint {
Content: req.Content,
}

saved, err := svc.Add(req.token, config)
saved, err := svc.Add(ctx, req.token, config)
if err != nil {
return nil, err
}
Expand All @@ -49,13 +49,13 @@ func addEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func updateCertEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(updateCertReq)
if err := req.validate(); err != nil {
return nil, err
}

if err := svc.UpdateCert(req.key, req.thingID, req.ClientCert, req.ClientKey, req.CACert); err != nil {
if err := svc.UpdateCert(ctx, req.key, req.thingID, req.ClientCert, req.ClientKey, req.CACert); err != nil {
return nil, err
}

Expand All @@ -66,14 +66,14 @@ func updateCertEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func viewEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(entityReq)

if err := req.validate(); err != nil {
return nil, err
}

config, err := svc.View(req.key, req.id)
config, err := svc.View(ctx, req.key, req.id)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -103,7 +103,7 @@ func viewEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func updateEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(updateReq)

if err := req.validate(); err != nil {
Expand All @@ -116,7 +116,7 @@ func updateEndpoint(svc bootstrap.Service) endpoint.Endpoint {
Content: req.Content,
}

if err := svc.Update(req.key, config); err != nil {
if err := svc.Update(ctx, req.key, config); err != nil {
return nil, err
}

Expand All @@ -130,14 +130,14 @@ func updateEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func updateConnEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(updateConnReq)

if err := req.validate(); err != nil {
return nil, err
}

if err := svc.UpdateConnections(req.key, req.id, req.Channels); err != nil {
if err := svc.UpdateConnections(ctx, req.key, req.id, req.Channels); err != nil {
return nil, err
}

Expand All @@ -151,14 +151,14 @@ func updateConnEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func listEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(listReq)

if err := req.validate(); err != nil {
return nil, err
}

page, err := svc.List(req.key, req.filter, req.offset, req.limit)
page, err := svc.List(ctx, req.key, req.filter, req.offset, req.limit)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -197,14 +197,14 @@ func listEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func removeEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(entityReq)

if err := req.validate(); err != nil {
return removeRes{}, err
}

if err := svc.Remove(req.key, req.id); err != nil {
if err := svc.Remove(ctx, req.key, req.id); err != nil {
return nil, err
}

Expand All @@ -213,13 +213,13 @@ func removeEndpoint(svc bootstrap.Service) endpoint.Endpoint {
}

func bootstrapEndpoint(svc bootstrap.Service, reader bootstrap.ConfigReader, secure bool) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(bootstrapReq)
if err := req.validate(); err != nil {
return nil, err
}

cfg, err := svc.Bootstrap(req.key, req.id, secure)
cfg, err := svc.Bootstrap(ctx, req.key, req.id, secure)
if err != nil {
return nil, err
}
Expand All @@ -229,14 +229,14 @@ func bootstrapEndpoint(svc bootstrap.Service, reader bootstrap.ConfigReader, sec
}

func stateEndpoint(svc bootstrap.Service) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(changeStateReq)

if err := req.validate(); err != nil {
return nil, err
}

if err := svc.ChangeState(req.key, req.id, req.State); err != nil {
if err := svc.ChangeState(ctx, req.key, req.id, req.State); err != nil {
return nil, err
}

Expand Down
19 changes: 10 additions & 9 deletions bootstrap/api/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package api_test

import (
"context"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
Expand Down Expand Up @@ -339,7 +340,7 @@ func TestView(t *testing.T) {
})
}

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

var channels []channel
Expand Down Expand Up @@ -428,7 +429,7 @@ func TestUpdate(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

data := toJSON(updateReq)
Expand Down Expand Up @@ -522,7 +523,7 @@ func TestUpdateCert(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

data := toJSON(updateReq)
Expand Down Expand Up @@ -617,7 +618,7 @@ func TestUpdateConnections(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

data := toJSON(updateReq)
Expand Down Expand Up @@ -736,7 +737,7 @@ func TestList(t *testing.T) {
c.Name = fmt.Sprintf("%s-%d", addName, i)
c.ExternalKey = fmt.Sprintf("%s%s", addExternalKey, strconv.Itoa(i))

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

var channels []channel
Expand All @@ -762,7 +763,7 @@ func TestList(t *testing.T) {
if i%2 == 0 {
state = bootstrap.Inactive
}
err := svc.ChangeState(validToken, list[i].MFThing, state)
err := svc.ChangeState(context.Background(), validToken, list[i].MFThing, state)
require.Nil(t, err, fmt.Sprintf("Changing state expected to succeed: %s.\n", err))
list[i].State = state
if state == bootstrap.Inactive {
Expand Down Expand Up @@ -978,7 +979,7 @@ func TestRemove(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

cases := []struct {
Expand Down Expand Up @@ -1040,7 +1041,7 @@ func TestBootstrap(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

encExternKey, err := enc([]byte(c.ExternalKey))
Expand Down Expand Up @@ -1168,7 +1169,7 @@ func TestChangeState(t *testing.T) {

c := newConfig([]bootstrap.Channel{bootstrap.Channel{ID: "1"}})

saved, err := svc.Add(validToken, c)
saved, err := svc.Add(context.Background(), validToken, c)
require.Nil(t, err, fmt.Sprintf("Saving config expected to succeed: %s.\n", err))

inactive := fmt.Sprintf("{\"state\": %d}", bootstrap.Inactive)
Expand Down
Loading

0 comments on commit 516c02b

Please sign in to comment.