Skip to content

Commit

Permalink
Cover the conflicting auth case in a test
Browse files Browse the repository at this point in the history
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
  • Loading branch information
ddelnano committed Mar 14, 2024
1 parent 36d28f4 commit 015e4ce
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions xoa/data_source_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ func TestAccXenorchestraDataSource_hostXoTokenAuth(t *testing.T) {
)
}

func TestAccXenorchestraDataSource_hostXoTokenAuthShouldFail(t *testing.T) {
resourceName := "data.xenorchestra_host.host"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`provider xenorchestra {
alias = "token_auth"
token = %s
}
`, accTestXoToken) + testAccXenorchestraDataSourceHostConfig(accTestHost.NameLabel),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckXenorchestraDataSourceHost(resourceName),
resource.TestCheckResourceAttrSet(resourceName, "id"),
resource.TestCheckResourceAttrSet(resourceName, "cpus.cores"),
resource.TestCheckResourceAttrSet(resourceName, "cpus.sockets"),
resource.TestCheckResourceAttrSet(resourceName, "memory"),
resource.TestCheckResourceAttrSet(resourceName, "memory_usage"),
resource.TestCheckResourceAttr(resourceName, "name_label", accTestHost.NameLabel)),
ExpectError: regexp.MustCompile(`Error: Conflicting configuration arguments`),
},
},
},
)
}

func TestAccXenorchestraDataSource_hostNotFound(t *testing.T) {
resourceName := "data.xenorchestra_host.host"
resource.Test(t, resource.TestCase{
Expand Down

0 comments on commit 015e4ce

Please sign in to comment.