Skip to content

Commit

Permalink
cached_image: add test for VM support
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcstephens committed Aug 10, 2023
1 parent e155147 commit 4a45936
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lxd/resource_lxd_cached_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestAccCachedImage_basicVM(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCachedImageExists(t, "lxd_cached_image.img1vm", &img),
resourceAccCachedImageCheckAttributes("lxd_cached_image.img1vm", &img),
testAccCachedImageIsVM(&img),
),
},
},
Expand Down Expand Up @@ -307,6 +308,16 @@ func resourceAccCachedImageCheckAttributes(n string, img *api.Image) resource.Te
}
}

func testAccCachedImageIsVM(img *api.Image) resource.TestCheckFunc {
return func(s *terraform.State) error {
if img.Type != "virtual-machine" {
return fmt.Errorf("Cached image is not a virtual-machine as requested")
}

return nil
}
}

func testAccCachedImage_basic() string {
return fmt.Sprintf(`
resource "lxd_cached_image" "img1" {
Expand Down

0 comments on commit 4a45936

Please sign in to comment.