Fix broken system tests when updating primary conn

We no longer compare config changes on primary connection
Just override the values from the old one
This commit is contained in:
Denis Arh
2022-08-09 20:52:21 +02:00
parent 5892250cdf
commit 1a358dd255
2 changed files with 14 additions and 9 deletions
+6 -9
View File
@@ -3,7 +3,6 @@ package service
import (
"context"
"fmt"
"reflect"
"regexp"
"github.com/cortezaproject/corteza-server/pkg/errors"
@@ -139,14 +138,12 @@ func (svc *dalConnection) Update(ctx context.Context, upd *types.DalConnection)
// validate
{
if old.Type == types.DalPrimaryConnectionResourceType {
if !reflect.DeepEqual(old.Config.Connection, upd.Config.Connection) {
// @todo err
return fmt.Errorf("can not update connection parameters for primary connection")
}
if old.Type != upd.Type {
return fmt.Errorf("can not update type for primary connection")
}
// when primary connection is updated,
// ignore configuration changes
//
// see Test_dal_connection_update_primary
// for more details
upd.Config = old.Config
}
}
+8
View File
@@ -191,6 +191,14 @@ func Test_dal_connection_update_primary(t *testing.T) {
helpers.AllowMe(h, types.DalConnectionRbacResource(0), "update")
// a bit of a problem with testing primary connection update
//
// when using (for running tests) anything else than connection params specified
// in the generic.json scenario, the update will fail
// with "can not update connection parameters for primary ..."
//
// see Update on dalConnection service.
h.apiInit().
Put(fmt.Sprintf("/dal/connections/%d", sl.ID)).
Header("Accept", "application/json").