Skip to content

Commit

Permalink
add test for source id
Browse files Browse the repository at this point in the history
  • Loading branch information
SwampDragons committed Sep 29, 2021
1 parent 086767b commit 6505f23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packer/registry/image/fromartifact_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ func ExampleWithProvider() {
// image.Image{ImageID:"service-id-123", ProviderName:"happycloud", ProviderRegion:"west", Labels:map[string]string{}, SourceImageID:""}
}

func ExampleWithSourceImageImageID() {
a := &simpleArtifact{
image_id: "service-id-123",
}

// This example also includes an override for the ProviderRegion to illustrate how ArtifactOverrideFunc(s) can be chained.
hcimage, _ := image.FromArtifact(a, image.WithProvider("happycloud"), image.WithRegion("west"), image.WithSourceID("ami-12345"))
fmt.Printf("%#v", *hcimage)
// Output:
// image.Image{ImageID:"service-id-123", ProviderName:"happycloud", ProviderRegion:"west", Labels:map[string]string{}, SourceImageID:"ami-12345"}
}

func ExampleSetLabels() {
a := &simpleArtifact{
image_id: "service-id-123",
Expand Down

0 comments on commit 6505f23

Please sign in to comment.