fix tag ignored issue

Signed-off-by: jason yang <jasonyangshadow@gmail.com>
This commit is contained in:
jason yang
2024-01-19 02:46:27 +00:00
committed by Jonathon Anderson
parent 7d17bcc6fa
commit d0b396b89c
3 changed files with 72 additions and 0 deletions

View File

@@ -414,3 +414,69 @@ nodes:
run_test(t, tt)
}
}
func Test_Node_Add(t *testing.T) {
tests := []test_description{
{
args: []string{"--tagadd=email=node", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles:
default:
comment: testit
tags:
email: profile
nodes:
n01:
profiles:
- default`,
outDb: `WW_INTERNAL: 43
nodeprofiles:
default:
comment: testit
tags:
email: profile
nodes:
n01:
profiles:
- default
tags:
email: node
`},
{
args: []string{"--tagadd=newtag=newval", "n01"},
wantErr: false,
stdout: "",
inDB: `WW_INTERNAL: 43
nodeprofiles:
default:
comment: testit
tags:
email: profile
nodes:
n01:
profiles:
- default
tags:
email: node`,
outDb: `WW_INTERNAL: 43
nodeprofiles:
default:
comment: testit
tags:
email: profile
nodes:
n01:
profiles:
- default
tags:
email: node
newtag: newval
`},
}
for _, tt := range tests {
run_test(t, tt)
}
}