uncomment duplicate check tests
This commit is contained in:
parent
75a639775e
commit
4479f73995
@ -169,133 +169,152 @@ func TestParser_ParseFile(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// "duplicate " + sourceLabel, defaultParser,
|
"duplicate " + sourceLabel, defaultParser,
|
||||||
// args{"testdata/sources/basic.pkr.hcl", &PackerConfig{
|
args{"testdata/sources/basic.pkr.hcl", &PackerConfig{
|
||||||
// Sources: map[SourceRef]*Source{
|
Sources: map[SourceRef]*Source{
|
||||||
// SourceRef{
|
SourceRef{
|
||||||
// Type: "amazon-ebs",
|
Type: "virtualbox-iso",
|
||||||
// Name: "ubuntu-1604",
|
Name: "ubuntu-1204",
|
||||||
// }: {
|
}: {
|
||||||
// Type: "amazon-ebs",
|
Type: "virtualbox-iso",
|
||||||
// Name: "ubuntu-1604",
|
Name: "ubuntu-1204",
|
||||||
// Cfg: &amazonebs.FlatConfig{RawRegion: "eu-west-3", InstanceType: "t2.micro"},
|
Cfg: &iso.FlatConfig{
|
||||||
// },
|
HTTPDir: strPtr("xxx"),
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// &PackerConfig{
|
},
|
||||||
// Sources: map[SourceRef]*Source{
|
},
|
||||||
// SourceRef{
|
&PackerConfig{
|
||||||
// Type: "virtualbox-iso",
|
Sources: map[SourceRef]*Source{
|
||||||
// Name: "ubuntu-1204",
|
SourceRef{
|
||||||
// }: {
|
Type: "virtualbox-iso",
|
||||||
// Type: "virtualbox-iso",
|
Name: "ubuntu-1204",
|
||||||
// Name: "ubuntu-1204",
|
}: {
|
||||||
// Cfg: &iso.FlatConfig{
|
Type: "virtualbox-iso",
|
||||||
// HTTPDir: "xxx",
|
Name: "ubuntu-1204",
|
||||||
// ISOChecksum: "769474248a3897f4865817446f9a4a53",
|
Cfg: &iso.FlatConfig{
|
||||||
// ISOChecksumType: "md5",
|
HTTPDir: strPtr("xxx"),
|
||||||
// RawSingleISOUrl: "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso",
|
},
|
||||||
// BootCommand: []string{"..."},
|
},
|
||||||
// ShutdownCommand: "echo 'vagrant' | sudo -S shutdown -P now",
|
SourceRef{
|
||||||
// RawBootWait: "10s",
|
Type: "amazon-ebs",
|
||||||
// },
|
Name: "ubuntu-1604",
|
||||||
// },
|
}: {
|
||||||
// SourceRef{
|
Type: "amazon-ebs",
|
||||||
// Type: "amazon-ebs",
|
Name: "ubuntu-1604",
|
||||||
// Name: "ubuntu-1604",
|
Cfg: &amazonebs.FlatConfig{
|
||||||
// }: {
|
RawRegion: strPtr("eu-west-3"),
|
||||||
// Type: "amazon-ebs",
|
AMIEncryptBootVolume: boolPtr(true),
|
||||||
// Name: "ubuntu-1604",
|
InstanceType: strPtr("t2.micro"),
|
||||||
// Cfg: &amazonebs.FlatConfig{RawRegion: "eu-west-3", InstanceType: "t2.micro"},
|
SourceAmiFilter: &awscommon.FlatAmiFilterOptions{
|
||||||
// },
|
Filters: map[string]string{
|
||||||
// SourceRef{
|
"name": "ubuntu/images/*ubuntu-xenial-{16.04}-amd64-server-*",
|
||||||
// Type: "amazon-ebs",
|
"root-device-type": "ebs",
|
||||||
// Name: "that-ubuntu-1.0",
|
"virtualization-type": "hvm",
|
||||||
// }: {
|
},
|
||||||
// Type: "amazon-ebs",
|
Owners: []string{"099720109477"},
|
||||||
// Name: "that-ubuntu-1.0",
|
},
|
||||||
// Cfg: &amazonebs.FlatConfig{RawRegion: "eu-west-3", InstanceType: "t2.micro"},
|
AMIMappings: []awscommon.FlatBlockDevice{},
|
||||||
// },
|
LaunchMappings: []awscommon.FlatBlockDevice{},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// true,
|
SourceRef{
|
||||||
// },
|
Type: "amazon-ebs",
|
||||||
|
Name: "that-ubuntu-1.0",
|
||||||
|
}: {
|
||||||
|
Type: "amazon-ebs",
|
||||||
|
Name: "that-ubuntu-1.0",
|
||||||
|
Cfg: &amazonebs.FlatConfig{
|
||||||
|
RawRegion: strPtr("eu-west-3"),
|
||||||
|
AMIEncryptBootVolume: boolPtr(true),
|
||||||
|
InstanceType: strPtr("t2.micro"),
|
||||||
|
SourceAmiFilter: &awscommon.FlatAmiFilterOptions{
|
||||||
|
MostRecent: boolPtr(true),
|
||||||
|
},
|
||||||
|
AMIMappings: []awscommon.FlatBlockDevice{},
|
||||||
|
LaunchMappings: []awscommon.FlatBlockDevice{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
|
||||||
// {"valid variables load", defaultParser,
|
{"valid variables load", defaultParser,
|
||||||
// args{"testdata/variables/basic.pkr.hcl", new(PackerConfig)},
|
args{"testdata/variables/basic.pkr.hcl", new(PackerConfig)},
|
||||||
// &PackerConfig{
|
&PackerConfig{
|
||||||
// Variables: PackerV1Variables{
|
Variables: PackerV1Variables{
|
||||||
// "image_name": "foo-image-{{user `my_secret`}}",
|
"image_name": "foo-image-{{user `my_secret`}}",
|
||||||
// "key": "value",
|
"key": "value",
|
||||||
// "my_secret": "foo",
|
"my_secret": "foo",
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// false,
|
false,
|
||||||
// },
|
},
|
||||||
|
|
||||||
// {"valid " + buildLabel + " load", defaultParser,
|
{"valid " + buildLabel + " load", defaultParser,
|
||||||
// args{"testdata/build/basic.pkr.hcl", new(PackerConfig)},
|
args{"testdata/build/basic.pkr.hcl", new(PackerConfig)},
|
||||||
// &PackerConfig{
|
&PackerConfig{
|
||||||
// Builds: Builds{
|
Builds: Builds{
|
||||||
// {
|
{
|
||||||
// Froms: BuildFromList{
|
Froms: BuildFromList{
|
||||||
// {
|
{
|
||||||
// Src: SourceRef{"amazon-ebs", "ubuntu-1604"},
|
Src: SourceRef{"amazon-ebs", "ubuntu-1604"},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// Src: SourceRef{"virtualbox-iso", "ubuntu-1204"},
|
Src: SourceRef{"virtualbox-iso", "ubuntu-1204"},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// ProvisionerGroups: ProvisionerGroups{
|
ProvisionerGroups: ProvisionerGroups{
|
||||||
// &ProvisionerGroup{
|
&ProvisionerGroup{
|
||||||
// CommunicatorRef: CommunicatorRef{"ssh", "vagrant"},
|
CommunicatorRef: CommunicatorRef{"ssh", "vagrant"},
|
||||||
// Provisioners: []Provisioner{
|
Provisioners: []Provisioner{
|
||||||
// {Cfg: &shell.FlatConfig{
|
{Cfg: &shell.FlatConfig{
|
||||||
// Inline: []string{"echo '{{user `my_secret`}}' :D"},
|
Inline: []string{"echo '{{user `my_secret`}}' :D"},
|
||||||
// }},
|
}},
|
||||||
// {Cfg: &shell.FlatConfig{
|
{Cfg: &shell.FlatConfig{
|
||||||
// Scripts: []string{"script-1.sh", "script-2.sh"},
|
Scripts: []string{"script-1.sh", "script-2.sh"},
|
||||||
// ValidExitCodes: []int{0, 42},
|
ValidExitCodes: []int{0, 42},
|
||||||
// }},
|
}},
|
||||||
// {Cfg: &file.FlatConfig{
|
{Cfg: &file.FlatConfig{
|
||||||
// Source: "app.tar.gz",
|
Source: strPtr("app.tar.gz"),
|
||||||
// Destination: "/tmp/app.tar.gz",
|
Destination: strPtr("/tmp/app.tar.gz"),
|
||||||
// }},
|
}},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// PostProvisionerGroups: ProvisionerGroups{
|
PostProvisionerGroups: ProvisionerGroups{
|
||||||
// &ProvisionerGroup{
|
&ProvisionerGroup{
|
||||||
// Provisioners: []Provisioner{
|
Provisioners: []Provisioner{
|
||||||
// {Cfg: &amazon_import.FlatConfig{
|
{Cfg: &amazon_import.FlatConfig{
|
||||||
// Name: "that-ubuntu-1.0",
|
Name: strPtr("that-ubuntu-1.0"),
|
||||||
// }},
|
}},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// &Build{
|
&Build{
|
||||||
// Froms: BuildFromList{
|
Froms: BuildFromList{
|
||||||
// {
|
{
|
||||||
// Src: SourceRef{"amazon", "that-ubuntu-1"},
|
Src: SourceRef{"amazon", "that-ubuntu-1"},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// ProvisionerGroups: ProvisionerGroups{
|
ProvisionerGroups: ProvisionerGroups{
|
||||||
// &ProvisionerGroup{
|
&ProvisionerGroup{
|
||||||
// Provisioners: []Provisioner{
|
Provisioners: []Provisioner{
|
||||||
// {Cfg: &shell.FlatConfig{
|
{Cfg: &shell.FlatConfig{
|
||||||
// Inline: []string{"echo HOLY GUACAMOLE !"},
|
Inline: []string{"echo HOLY GUACAMOLE !"},
|
||||||
// }},
|
}},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// false,
|
false,
|
||||||
// },
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user