1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-05 20:09:16 +00:00

for test using conf global variable

This commit is contained in:
postmannen 2022-06-01 13:15:15 +02:00
parent 4bfc4f3f03
commit fefa3087a9

View file

@ -15,7 +15,7 @@ func TestACLSingleNode(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
a.aclAddCommand("ship101", "admin", "HORSE") a.aclAddCommand("ship101", "admin", "HORSE")
a.aclAddCommand("ship101", "admin", "PIG") a.aclAddCommand("ship101", "admin", "PIG")
@ -43,7 +43,7 @@ func TestACLWithGroups(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
const ( const (
grp_nodes_operators = "grp_nodes_operators" grp_nodes_operators = "grp_nodes_operators"
@ -104,7 +104,7 @@ func TestACLNodesGroupDeleteNode(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
const ( const (
grp_nodes_operators = "grp_nodes_operators" grp_nodes_operators = "grp_nodes_operators"
@ -163,7 +163,7 @@ func TestGroupNodesDeleteGroup(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
const ( const (
grp_nodes_operators = "grp_nodes_operators" grp_nodes_operators = "grp_nodes_operators"
@ -222,7 +222,7 @@ func TestGroupCommandDeleteGroup(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
const ( const (
grp_nodes_operators = "grp_nodes_operators" grp_nodes_operators = "grp_nodes_operators"
@ -281,7 +281,7 @@ func TestACLGenerated(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
a.aclAddCommand("ship101", "admin", "HORSE") a.aclAddCommand("ship101", "admin", "HORSE")
@ -332,7 +332,7 @@ func TestACLSchemaMainACLMap(t *testing.T) {
log.SetOutput(io.Discard) log.SetOutput(io.Discard)
} }
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
//a.aclNodeFromnodeCommandAdd("ship101", "admin", "PIG") //a.aclNodeFromnodeCommandAdd("ship101", "admin", "PIG")
// fmt.Printf("---------------ADDING COMMAND-------------\n") // fmt.Printf("---------------ADDING COMMAND-------------\n")
@ -415,7 +415,7 @@ func TestACLSchemaMainACLMap(t *testing.T) {
// log.SetOutput(io.Discard) // log.SetOutput(io.Discard)
// } // }
// //
// a := newAccessLists(&errorKernel{}, &Configuration{}) // a := newAccessLists(&errorKernel{}, tstConf)
// //
// a.aclAddCommand("ship101", "admin", "HORSE") // a.aclAddCommand("ship101", "admin", "HORSE")
// //
@ -434,7 +434,7 @@ func TestACLSchemaMainACLMap(t *testing.T) {
// } // }
func TestACLConcurrent(t *testing.T) { func TestACLConcurrent(t *testing.T) {
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
// -----------General testing and creation of some data---------------- // -----------General testing and creation of some data----------------
@ -488,7 +488,7 @@ func TestACLConcurrent(t *testing.T) {
// grp_commands_commandset1 = "grp_commands_commandset1" // grp_commands_commandset1 = "grp_commands_commandset1"
// ) // )
// //
// a := newAccessLists(&errorKernel{}, &Configuration{}) // a := newAccessLists(&errorKernel{}, tstConf)
// //
// a.groupNodesAddNode(grp_nodes_operators, "operator1") // a.groupNodesAddNode(grp_nodes_operators, "operator1")
// a.groupNodesAddNode(grp_nodes_operators, "operator2") // a.groupNodesAddNode(grp_nodes_operators, "operator2")
@ -529,7 +529,7 @@ func TestImportACLs(t *testing.T) {
want := `map[grp_nodes_ships:map[admin:map[useradd -m kongen:{}] grp_nodes_operators:map[grp_commands_commandset1:{}]] ship101:map[admin:map[HORSE:{}]]]` want := `map[grp_nodes_ships:map[admin:map[useradd -m kongen:{}] grp_nodes_operators:map[grp_commands_commandset1:{}]] ship101:map[admin:map[HORSE:{}]]]`
a := newAccessLists(&pki{}, &errorKernel{}, &Configuration{}) a := newAccessLists(&pki{}, &errorKernel{}, tstConf)
err := a.importACLs(js) err := a.importACLs(js)
if err != nil { if err != nil {