From b511295349f10cc2b15e2b037c2c27f1866e9687 Mon Sep 17 00:00:00 2001 From: Adrien Raffin-Caboisse Date: Fri, 13 May 2022 13:02:40 +0200 Subject: [PATCH] fix: integration tests result Execute command doesn't fail, the result is passed in json content. --- integration_cli_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/integration_cli_test.go b/integration_cli_test.go index 55c42304..e79a4ea4 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -601,7 +601,7 @@ func (s *IntegrationCLITestSuite) TestNodeTagCommand() { assert.Equal(s.T(), []string{"tag:test"}, machine.ForcedTags) // try to set a wrong tag and retrieve the error - _, err = ExecuteCommand( + wrongTagResult, err := ExecuteCommand( &s.headscale, []string{ "headscale", @@ -613,7 +613,14 @@ func (s *IntegrationCLITestSuite) TestNodeTagCommand() { }, []string{}, ) - assert.ErrorContains(s.T(), err, "Invalid tag detected") + assert.Nil(s.T(), err) + type errOutput struct { + Error string `json:"error"` + } + var errorOutput errOutput + err = json.Unmarshal([]byte(wrongTagResult), &errorOutput) + assert.Nil(s.T(), err) + assert.Contains(s.T(), errorOutput.Error, "Invalid tag detected") // Test list all nodes after added seconds listAllResult, err := ExecuteCommand(