Skip to content

Commit

Permalink
fix expected 404 error message in VLANs and subnet tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d-costa committed Feb 26, 2024
1 parent b5d7169 commit 810809c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugin/providers/phpipam/resource_phpipam_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ func testAccCheckResourcePHPIPAMSubnetCreated(s *terraform.State) error {
func testAccCheckResourcePHPIPAMSubnetDeleted(s *terraform.State) error {
subnetController := testAccProvider.Meta().(*ProviderPHPIPAMClient).subnetsController
_, err := subnetController.GetSubnetsByCIDRAndSection(testAccResourcePHPIPAMSubnetCIDR, testAccResourceSubnetPHPIPAMSectionID)
error_messages := linearSearchSlice{"Error from API (404): No results (filter applied)", "Error from API (404): No subnets found"}
switch {
case err == nil:
return errors.New("Expected error, got none")
case err != nil && err.Error() != "Error from API (404): No results (filter applied)":
case err != nil && !error_messages.Has(err.Error()):
return fmt.Errorf("Expected 404, got %s", err)
}

Expand Down
3 changes: 2 additions & 1 deletion plugin/providers/phpipam/resource_phpipam_vlan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ func testAccCheckResourcePHPIPAMVLANCreated(s *terraform.State) error {
func testAccCheckResourcePHPIPAMVLANDeleted(s *terraform.State) error {
c := testAccProvider.Meta().(*ProviderPHPIPAMClient).vlansController
_, err := c.GetVLANsByNumberAndDomainID(testAccResourcePHPIPAMVLANNumber, testAccResourceVlanPHPIPAML2DomainID)
error_messages := linearSearchSlice{"Error from API (404): No results (filter applied)", "Error from API (404): Vlans not found"}
switch {
case err == nil:
return errors.New("Expected error, got none")
case err != nil && err.Error() != "Error from API (404): No results (filter applied)":
case err != nil && !error_messages.Has(err.Error()):
return fmt.Errorf("Expected 404, got %s", err)
}

Expand Down

0 comments on commit 810809c

Please sign in to comment.