Fix remaining tests
This commit is contained in:
@@ -198,10 +198,8 @@ test.store: $(GOTEST)
|
||||
$(GOTEST) $(TEST_FLAGS) $(TEST_SUITE_store)
|
||||
|
||||
# Runs ALL tests
|
||||
test.all:
|
||||
@echo "pass"
|
||||
#test.all: $(GOTEST)
|
||||
# $(GOTEST) $(TEST_FLAGS) $(TEST_SUITE_all)
|
||||
test.all: $(GOTEST)
|
||||
$(GOTEST) $(TEST_FLAGS) $(TEST_SUITE_all)
|
||||
|
||||
# Unit testing testing, system or compose
|
||||
test.unit.%: $(GOTEST)
|
||||
|
||||
+1
-4
@@ -635,10 +635,7 @@ func (svc *service) ReplaceModel(ctx context.Context, model *Model) (err error)
|
||||
defer svc.updateIssues(issues)
|
||||
|
||||
if model.ConnectionID == 0 {
|
||||
// model w/o connection:
|
||||
// add model issue and carry on
|
||||
issues.addModelIssue(model.ResourceID, errConnectionNotFound(model.ConnectionID))
|
||||
return nil
|
||||
model.ConnectionID = svc.defConnID
|
||||
}
|
||||
|
||||
// Check if update
|
||||
|
||||
@@ -82,7 +82,7 @@ type (
|
||||
// type of connection
|
||||
Type string `json:"type"`
|
||||
|
||||
// parameters for th connection
|
||||
// parameters for the connection
|
||||
Params map[string]any `json:"params"`
|
||||
|
||||
// ident to be used when generating models from modules using this connection
|
||||
|
||||
@@ -114,6 +114,7 @@ func Test_dal_crud_connection_update(t *testing.T) {
|
||||
})
|
||||
|
||||
helpers.AllowMe(h, types.DalConnectionRbacResource(0), "update")
|
||||
helpers.AllowMe(h, types.DalConnectionRbacResource(0), "dal-config.manage")
|
||||
|
||||
h.apiInit().
|
||||
Put(fmt.Sprintf("/system/dal/connections/%d", sl.ID)).
|
||||
|
||||
@@ -24,7 +24,7 @@ type (
|
||||
driver struct {
|
||||
name string
|
||||
dsn string
|
||||
setup func(ctx context.Context, t aaaa, dsn string)
|
||||
setup func(ctx context.Context, t wrapTest, dsn string)
|
||||
}
|
||||
|
||||
dalService interface {
|
||||
@@ -72,7 +72,7 @@ type (
|
||||
}
|
||||
}
|
||||
|
||||
aaaa interface {
|
||||
wrapTest interface {
|
||||
require.TestingT
|
||||
Name() string
|
||||
}
|
||||
@@ -153,7 +153,12 @@ func initSvc(ctx context.Context, d driver) (dalService, error) {
|
||||
dal.MakeConnection(
|
||||
c.ID,
|
||||
nil,
|
||||
dal.ConnectionParams{},
|
||||
dal.ConnectionParams{
|
||||
Type: "corteza::dal:connection:dsn",
|
||||
Params: map[string]any{
|
||||
"dsn": d.dsn,
|
||||
},
|
||||
},
|
||||
cm,
|
||||
),
|
||||
true,
|
||||
@@ -284,7 +289,7 @@ func collectDrivers() []driver {
|
||||
{
|
||||
name: "mysql",
|
||||
dsn: os.Getenv("DAL_TEST_DSN_MYSQL"),
|
||||
setup: func(ctx context.Context, t aaaa, dsn string) {
|
||||
setup: func(ctx context.Context, t wrapTest, dsn string) {
|
||||
conn, err := mysql.Setup(ctx, dsn)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ func rs(a ...int) string {
|
||||
return string(rand.Bytes(l))
|
||||
}
|
||||
|
||||
func loadScenarioSources(t aaaa, driver, ext string) (src string) {
|
||||
func loadScenarioSources(t wrapTest, driver, ext string) (src string) {
|
||||
scenarioName := t.Name()[5:]
|
||||
|
||||
src = loadScenarioSource(t, "generic", fmt.Sprintf("_.%s", ext))
|
||||
@@ -430,7 +430,7 @@ func loadScenarioSources(t aaaa, driver, ext string) (src string) {
|
||||
return
|
||||
}
|
||||
|
||||
func loadScenarioSource(t aaaa, scenarioName, srcName string) (src string) {
|
||||
func loadScenarioSource(t wrapTest, scenarioName, srcName string) (src string) {
|
||||
f, err := os.Open(path.Join("testdata", scenarioName, srcName))
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
return ""
|
||||
|
||||
+3
-19
@@ -17,7 +17,9 @@
|
||||
},
|
||||
|
||||
"config": {
|
||||
"connection": {
|
||||
"dal": {
|
||||
"modelIdent": "compose_record",
|
||||
|
||||
"type": "corteza::dal:connection:dsn",
|
||||
"params": {
|
||||
"dsn": "NO"
|
||||
@@ -25,24 +27,6 @@
|
||||
},
|
||||
"privacy": {
|
||||
"sensitivityLevelID": "0"
|
||||
},
|
||||
"dal": {
|
||||
"properties": {},
|
||||
"operations": [
|
||||
"corteza::dal:operation:create",
|
||||
"corteza::dal:operation:update",
|
||||
"corteza::dal:operation:search",
|
||||
"corteza::dal:operation:lookup",
|
||||
"corteza::dal:operation:paging",
|
||||
"corteza::dal:operation:stats",
|
||||
"corteza::dal:operation:sorting",
|
||||
"corteza::dal:operation:RBAC"
|
||||
],
|
||||
|
||||
"modelIdent": "compose_record",
|
||||
"attributeIdent": "values",
|
||||
"partitionFormat": "compose_record_{{namespace}}_{{module}}",
|
||||
"partitionIdentValidator": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-19
@@ -17,7 +17,9 @@
|
||||
},
|
||||
|
||||
"config": {
|
||||
"connection": {
|
||||
"dal": {
|
||||
"modelIdent": "compose_record",
|
||||
|
||||
"type": "corteza::dal:connection:dsn",
|
||||
"params": {
|
||||
"dsn": "sqlite3://file::memory:?cache=shared&mode=memory"
|
||||
@@ -25,24 +27,6 @@
|
||||
},
|
||||
"privacy": {
|
||||
"sensitivityLevelID": "0"
|
||||
},
|
||||
"dal": {
|
||||
"properties": {},
|
||||
"operations": [
|
||||
"corteza::dal:operation:create",
|
||||
"corteza::dal:operation:update",
|
||||
"corteza::dal:operation:search",
|
||||
"corteza::dal:operation:lookup",
|
||||
"corteza::dal:operation:paging",
|
||||
"corteza::dal:operation:stats",
|
||||
"corteza::dal:operation:sorting",
|
||||
"corteza::dal:operation:RBAC"
|
||||
],
|
||||
|
||||
"modelIdent": "compose_record",
|
||||
"attributeIdent": "values",
|
||||
"partitionFormat": "compose_record_{{namespace}}_{{module}}",
|
||||
"partitionIdentValidator": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-19
@@ -17,7 +17,9 @@
|
||||
},
|
||||
|
||||
"config": {
|
||||
"connection": {
|
||||
"dal": {
|
||||
"modelIdent": "compose_record",
|
||||
|
||||
"type": "corteza::dal:connection:dsn",
|
||||
"params": {
|
||||
"dsn": "sqlite3://file::memory:?cache=shared&mode=memory"
|
||||
@@ -25,24 +27,6 @@
|
||||
},
|
||||
"privacy": {
|
||||
"sensitivityLevelID": "42"
|
||||
},
|
||||
"dal": {
|
||||
"properties": {},
|
||||
"operations": [
|
||||
"corteza::dal:operation:create",
|
||||
"corteza::dal:operation:update",
|
||||
"corteza::dal:operation:search",
|
||||
"corteza::dal:operation:lookup",
|
||||
"corteza::dal:operation:paging",
|
||||
"corteza::dal:operation:stats",
|
||||
"corteza::dal:operation:sorting",
|
||||
"corteza::dal:operation:RBAC"
|
||||
],
|
||||
|
||||
"modelIdent": "compose_record",
|
||||
"attributeIdent": "values",
|
||||
"partitionFormat": "compose_record_{{namespace}}_{{module}}",
|
||||
"partitionIdentValidator": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-19
@@ -17,7 +17,9 @@
|
||||
},
|
||||
|
||||
"config": {
|
||||
"connection": {
|
||||
"dal": {
|
||||
"modelIdent": "compose_record",
|
||||
|
||||
"type": "corteza::dal:connection:dsn",
|
||||
"params": {
|
||||
"dsn": "sqlite3://file::memory:?cache=shared&mode=memory"
|
||||
@@ -25,24 +27,6 @@
|
||||
},
|
||||
"privacy": {
|
||||
"sensitivityLevelID": "0"
|
||||
},
|
||||
"dal": {
|
||||
"properties": {},
|
||||
"operations": [
|
||||
"corteza::dal:operation:create",
|
||||
"corteza::dal:operation:update",
|
||||
"corteza::dal:operation:search",
|
||||
"corteza::dal:operation:lookup",
|
||||
"corteza::dal:operation:paging",
|
||||
"corteza::dal:operation:stats",
|
||||
"corteza::dal:operation:sorting",
|
||||
"corteza::dal:operation:RBAC"
|
||||
],
|
||||
|
||||
"modelIdent": "compose_record",
|
||||
"attributeIdent": "values",
|
||||
"partitionFormat": "compose_record_{{namespace}}_{{module}}",
|
||||
"partitionIdentValidator": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-19
@@ -17,7 +17,9 @@
|
||||
},
|
||||
|
||||
"config": {
|
||||
"connection": {
|
||||
"dal": {
|
||||
"modelIdent": "compose_record",
|
||||
|
||||
"type": "corteza::dal:connection:dsn",
|
||||
"params": {
|
||||
"dsn": "sqlite3://file::memory:?cache=shared&mode=memory"
|
||||
@@ -25,24 +27,6 @@
|
||||
},
|
||||
"privacy": {
|
||||
"sensitivityLevelID": "0"
|
||||
},
|
||||
"dal": {
|
||||
"properties": {},
|
||||
"operations": [
|
||||
"corteza::dal:operation:create",
|
||||
"corteza::dal:operation:update",
|
||||
"corteza::dal:operation:search",
|
||||
"corteza::dal:operation:lookup",
|
||||
"corteza::dal:operation:paging",
|
||||
"corteza::dal:operation:stats",
|
||||
"corteza::dal:operation:sorting",
|
||||
"corteza::dal:operation:RBAC"
|
||||
],
|
||||
|
||||
"modelIdent": "compose_record",
|
||||
"attributeIdent": "values",
|
||||
"partitionFormat": "compose_record_{{namespace}}_{{module}}",
|
||||
"partitionIdentValidator": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user