mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 00:32:09 -04:00
Fixed Test Cases
This commit is contained in:
parent
99b8f98a8b
commit
24d73a2b6a
7 changed files with 81 additions and 43 deletions
|
|
@ -56,6 +56,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -110,6 +111,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
BuildName: "build2",
|
||||
|
|
@ -119,6 +121,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -173,6 +176,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
BuildName: "build2",
|
||||
|
|
@ -182,6 +186,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -237,6 +242,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
BuildName: "build2",
|
||||
|
|
@ -246,6 +252,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -292,6 +299,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -339,6 +347,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
BuilderType: "virtualbox-iso",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -399,6 +408,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
BuilderType: "virtualbox-iso",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -605,6 +615,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -652,6 +663,7 @@ func Test_ParseHCPPackerRegistryBlock(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
BuilderType: "null",
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ func TestParse_build(t *testing.T) {
|
|||
},
|
||||
true, true,
|
||||
[]*packer.CoreBuild{&packer.CoreBuild{
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
SensitiveVars: []string{},
|
||||
}},
|
||||
false,
|
||||
nil,
|
||||
|
|
@ -148,7 +149,9 @@ func TestParse_build(t *testing.T) {
|
|||
Builds: nil,
|
||||
},
|
||||
true, true,
|
||||
[]*packer.CoreBuild{&packer.CoreBuild{}},
|
||||
[]*packer.CoreBuild{&packer.CoreBuild{
|
||||
SensitiveVars: []string{},
|
||||
}},
|
||||
false,
|
||||
nil,
|
||||
},
|
||||
|
|
@ -190,6 +193,7 @@ func TestParse_build(t *testing.T) {
|
|||
true, true,
|
||||
[]*packer.CoreBuild{&packer.CoreBuild{
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
SensitiveVars: []string{},
|
||||
}},
|
||||
true,
|
||||
nil,
|
||||
|
|
@ -289,11 +293,12 @@ func TestParse_build(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
SensitiveVars: []string{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{
|
||||
{
|
||||
{
|
||||
|
|
@ -324,11 +329,12 @@ func TestParse_build(t *testing.T) {
|
|||
},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
Type: "amazon-ebs.aws-ubuntu-16.04",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
Type: "amazon-ebs.aws-ubuntu-16.04",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
SensitiveVars: []string{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{
|
||||
{
|
||||
{
|
||||
|
|
@ -407,10 +413,11 @@ func TestParse_build(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
SensitiveVars: []string{},
|
||||
Provisioners: []packer.CoreBuildProvisioner{
|
||||
{
|
||||
PType: "shell",
|
||||
|
|
@ -438,10 +445,11 @@ func TestParse_build(t *testing.T) {
|
|||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
Type: "amazon-ebs.aws-ubuntu-16.04",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Type: "amazon-ebs.aws-ubuntu-16.04",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
SensitiveVars: []string{},
|
||||
Provisioners: []packer.CoreBuildProvisioner{
|
||||
{
|
||||
PType: "file",
|
||||
|
|
@ -499,10 +507,11 @@ func TestParse_build(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
SensitiveVars: []string{},
|
||||
Provisioners: []packer.CoreBuildProvisioner{
|
||||
{
|
||||
PType: "shell",
|
||||
|
|
@ -570,6 +579,7 @@ func TestParse_build(t *testing.T) {
|
|||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -620,12 +630,13 @@ func TestParse_build(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
BuildName: "test-build",
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
BuildName: "test-build",
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
SensitiveVars: []string{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{
|
||||
{
|
||||
{
|
||||
|
|
@ -679,11 +690,12 @@ func TestParse_build(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
BuildName: "build-name-test",
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
BuildName: "build-name-test",
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Builder: emptyMockBuilder,
|
||||
SensitiveVars: []string{},
|
||||
Provisioners: []packer.CoreBuildProvisioner{
|
||||
{
|
||||
PName: "build-name-test",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ func TestParse_datasource(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -150,6 +151,7 @@ func TestParse_datasource(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -206,9 +206,10 @@ func TestParser_complete(t *testing.T) {
|
|||
false, false,
|
||||
[]*packer.CoreBuild{
|
||||
&packer.CoreBuild{
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
Type: "virtualbox-iso.ubuntu-1204",
|
||||
BuilderType: "virtualbox-iso",
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
Builder: &MockBuilder{
|
||||
Config: MockConfig{
|
||||
NestedMockConfig: NestedMockConfig{
|
||||
|
|
@ -318,9 +319,10 @@ func TestParser_complete(t *testing.T) {
|
|||
},
|
||||
},
|
||||
&packer.CoreBuild{
|
||||
Type: "amazon-ebs.ubuntu-1604",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
Type: "amazon-ebs.ubuntu-1604",
|
||||
BuilderType: "amazon-ebs",
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
Builder: &MockBuilder{
|
||||
Config: MockConfig{
|
||||
NestedMockConfig: NestedMockConfig{
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ func TestParse_source(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{"super_secret_password"},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -305,6 +306,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -393,6 +395,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -459,6 +462,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -502,6 +506,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -594,6 +599,7 @@ func TestParse_variables(t *testing.T) {
|
|||
},
|
||||
},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
@ -651,6 +657,7 @@ func TestParse_variables(t *testing.T) {
|
|||
Provisioners: []packer.CoreBuildProvisioner{},
|
||||
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
||||
Prepared: true,
|
||||
SensitiveVars: []string{},
|
||||
},
|
||||
},
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -39,8 +39,9 @@ func testBuild() *CoreBuild {
|
|||
{&MockPostProcessor{ArtifactId: "pp"}, "testPP", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(true)},
|
||||
},
|
||||
},
|
||||
Variables: make(map[string]string),
|
||||
onError: "cleanup",
|
||||
Variables: make(map[string]string),
|
||||
onError: "cleanup",
|
||||
SensitiveVars: []string{"sensitive_var"},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ func testDefaultPackerConfig() map[string]interface{} {
|
|||
common.OnErrorConfigKey: "cleanup",
|
||||
common.TemplatePathKey: "",
|
||||
common.UserVariablesConfigKey: make(map[string]string),
|
||||
common.SensitiveVarsConfigKey: []string{"sensitive_var"},
|
||||
}
|
||||
}
|
||||
func TestBuild_Name(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue