add integration test for headscale -c
This commit is contained in:
parent
402a29e50c
commit
ce13596077
5 changed files with 184 additions and 0 deletions
|
@ -1721,3 +1721,43 @@ func (s *IntegrationCLITestSuite) TestNodeMoveCommand() {
|
|||
|
||||
assert.Equal(s.T(), machine.Namespace, oldNamespace)
|
||||
}
|
||||
|
||||
func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() {
|
||||
// TODO: make sure defaultConfig is not same as altConfig
|
||||
defaultConfig, err := os.ReadFile("integration_test/etc/config.dump.gold.yaml")
|
||||
assert.Nil(s.T(), err)
|
||||
altConfig, err := os.ReadFile("integration_test/etc/alt-config.dump.gold.yaml")
|
||||
assert.Nil(s.T(), err)
|
||||
|
||||
_, err = ExecuteCommand(
|
||||
&s.headscale,
|
||||
[]string{
|
||||
"headscale",
|
||||
"dumpConfig",
|
||||
},
|
||||
[]string{},
|
||||
)
|
||||
assert.Nil(s.T(), err)
|
||||
|
||||
defaultDumpConfig, err := os.ReadFile("integration_test/etc/config.dump.yaml")
|
||||
assert.Nil(s.T(), err)
|
||||
|
||||
assert.YAMLEq(s.T(), string(defaultConfig), string(defaultDumpConfig))
|
||||
|
||||
_, err = ExecuteCommand(
|
||||
&s.headscale,
|
||||
[]string{
|
||||
"headscale",
|
||||
"-c",
|
||||
"/etc/headscale/alt-config.yaml",
|
||||
"dumpConfig",
|
||||
},
|
||||
[]string{},
|
||||
)
|
||||
assert.Nil(s.T(), err)
|
||||
|
||||
altDumpConfig, err := os.ReadFile("integration_test/etc/config.dump.yaml")
|
||||
assert.Nil(s.T(), err)
|
||||
|
||||
assert.YAMLEq(s.T(), string(altConfig), string(altDumpConfig))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue