mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
Tweaking the tests
This commit is contained in:
parent
0dc0cff14d
commit
97fd4f5b7d
@ -20,7 +20,6 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -57,7 +56,6 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -76,7 +74,6 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -86,7 +83,7 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
},
|
||||
},
|
||||
|
||||
"NOProxy": {
|
||||
"NoProxy": {
|
||||
Config: testConfig(t, map[string]interface{}{
|
||||
"http_proxy": "http://proxy.local",
|
||||
"no_proxy": []interface{}{"http://local.local", "http://local.org"},
|
||||
@ -96,7 +93,6 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -117,7 +113,6 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
"version": "11.18.6",
|
||||
}),
|
||||
|
||||
@ -161,10 +156,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
"ohai_hints": []interface{}{"test-fixtures/ohaihint.json"},
|
||||
"node_name": "nodename1",
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -176,11 +171,11 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/ohai/hints/ohaihint.json": "OHAI-HINT-FILE",
|
||||
linuxConfDir + "/client.rb": defaultLinuxClientConf,
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/first-boot.json": `{"run_list":["cookbook::recipe"]}`,
|
||||
linuxConfDir + "/ohai/hints/ohaihint.json": "OHAI-HINT-FILE",
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -189,10 +184,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
"node_name": "nodename1",
|
||||
"prevent_sudo": true,
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -200,10 +195,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/client.rb": defaultLinuxClientConf,
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/first-boot.json": `{"run_list":["cookbook::recipe"]}`,
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -215,10 +210,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
"node_name": "nodename1",
|
||||
"prevent_sudo": true,
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -226,10 +221,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/client.rb": proxyLinuxClientConf,
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/first-boot.json": `{"run_list":["cookbook::recipe"]}`,
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -259,10 +254,10 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
"node_name": "nodename1",
|
||||
"prevent_sudo": true,
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -270,9 +265,9 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/client.rb": defaultLinuxClientConf,
|
||||
linuxConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
linuxConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
linuxConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` +
|
||||
`"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`,
|
||||
},
|
||||
|
@ -230,6 +230,7 @@ func (r *ResourceProvisioner) decodeConfig(c *terraform.ResourceConfig) (*Provis
|
||||
}
|
||||
p.ValidationKeyPath = keyPath
|
||||
}
|
||||
|
||||
if p.SecretKeyPath != "" {
|
||||
keyPath, err := homedir.Expand(p.SecretKeyPath)
|
||||
if err != nil {
|
||||
@ -237,6 +238,7 @@ func (r *ResourceProvisioner) decodeConfig(c *terraform.ResourceConfig) (*Provis
|
||||
}
|
||||
p.SecretKeyPath = keyPath
|
||||
}
|
||||
|
||||
if attrs, ok := c.Config["attributes"]; ok {
|
||||
p.Attributes, err = rawToJSON(attrs)
|
||||
if err != nil {
|
||||
|
@ -21,7 +21,6 @@ func TestResourceProvider_Validate_good(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
})
|
||||
r := new(ResourceProvisioner)
|
||||
warn, errs := r.Validate(c)
|
||||
@ -69,7 +68,6 @@ func TestResourceProvider_runChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
ConfDir: linuxConfDir,
|
||||
@ -87,7 +85,6 @@ func TestResourceProvider_runChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
ConfDir: linuxConfDir,
|
||||
@ -106,7 +103,6 @@ func TestResourceProvider_runChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
ConfDir: windowsConfDir,
|
||||
|
@ -22,7 +22,6 @@ func TestResourceProvider_windowsInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -43,7 +42,6 @@ func TestResourceProvider_windowsInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -62,7 +60,6 @@ func TestResourceProvider_windowsInstallChefClient(t *testing.T) {
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "validator.pem",
|
||||
"secret_key_path": "encrypted_data_bag_secret",
|
||||
"version": "11.18.6",
|
||||
}),
|
||||
|
||||
@ -109,10 +106,10 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
"ohai_hints": []interface{}{"test-fixtures/ohaihint.json"},
|
||||
"node_name": "nodename1",
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -123,11 +120,11 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/ohai/hints/ohaihint.json": "OHAI-HINT-FILE",
|
||||
windowsConfDir + "/client.rb": defaultWindowsClientConf,
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/first-boot.json": `{"run_list":["cookbook::recipe"]}`,
|
||||
windowsConfDir + "/ohai/hints/ohaihint.json": "OHAI-HINT-FILE",
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -138,10 +135,10 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
"no_proxy": []interface{}{"http://local.local", "https://local.local"},
|
||||
"node_name": "nodename1",
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -149,10 +146,10 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/client.rb": proxyWindowsClientConf,
|
||||
windowsConfDir + "/first-boot.json": `{"run_list":["cookbook::recipe"]}`,
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -181,10 +178,10 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
"node_name": "nodename1",
|
||||
"run_list": []interface{}{"cookbook::recipe"},
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
"server_url": "https://chef.local",
|
||||
"validation_client_name": "validator",
|
||||
"validation_key_path": "test-fixtures/validator.pem",
|
||||
"secret_key_path": "test-fixtures/encrypted_data_bag_secret",
|
||||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
@ -192,9 +189,9 @@ func TestResourceProvider_windowsCreateConfigFiles(t *testing.T) {
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/client.rb": defaultWindowsClientConf,
|
||||
windowsConfDir + "/encrypted_data_bag_secret": "SECRET-KEY-FILE",
|
||||
windowsConfDir + "/validation.pem": "VALIDATOR-PEM-FILE",
|
||||
windowsConfDir + "/first-boot.json": `{"key1":{"subkey1":{"subkey2a":["val1","val2","val3"],` +
|
||||
`"subkey2b":{"subkey3":"value3"}}},"key2":"value2","run_list":["cookbook::recipe"]}`,
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ const _countHookAction_name = "countHookActionAddcountHookActionChangecountHookA
|
||||
var _countHookAction_index = [...]uint8{0, 18, 39, 60}
|
||||
|
||||
func (i countHookAction) String() string {
|
||||
if i >= countHookAction(len(_countHookAction_index)-1) {
|
||||
if i+1 >= countHookAction(len(_countHookAction_index)) {
|
||||
return fmt.Sprintf("countHookAction(%d)", i)
|
||||
}
|
||||
return _countHookAction_name[_countHookAction_index[i]:_countHookAction_index[i+1]]
|
||||
|
@ -9,7 +9,7 @@ const _ValueType_name = "TypeInvalidTypeBoolTypeIntTypeFloatTypeStringTypeListTy
|
||||
var _ValueType_index = [...]uint8{0, 11, 19, 26, 35, 45, 53, 60, 67, 77}
|
||||
|
||||
func (i ValueType) String() string {
|
||||
if i < 0 || i >= ValueType(len(_ValueType_index)-1) {
|
||||
if i < 0 || i+1 >= ValueType(len(_ValueType_index)) {
|
||||
return fmt.Sprintf("ValueType(%d)", i)
|
||||
}
|
||||
return _ValueType_name[_ValueType_index[i]:_ValueType_index[i+1]]
|
||||
|
@ -9,7 +9,7 @@ const _GraphNodeConfigType_name = "GraphNodeConfigTypeInvalidGraphNodeConfigType
|
||||
var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157}
|
||||
|
||||
func (i GraphNodeConfigType) String() string {
|
||||
if i < 0 || i >= GraphNodeConfigType(len(_GraphNodeConfigType_index)-1) {
|
||||
if i < 0 || i+1 >= GraphNodeConfigType(len(_GraphNodeConfigType_index)) {
|
||||
return fmt.Sprintf("GraphNodeConfigType(%d)", i)
|
||||
}
|
||||
return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]]
|
||||
|
@ -9,7 +9,7 @@ const _InstanceType_name = "TypeInvalidTypePrimaryTypeTaintedTypeDeposed"
|
||||
var _InstanceType_index = [...]uint8{0, 11, 22, 33, 44}
|
||||
|
||||
func (i InstanceType) String() string {
|
||||
if i < 0 || i >= InstanceType(len(_InstanceType_index)-1) {
|
||||
if i < 0 || i+1 >= InstanceType(len(_InstanceType_index)) {
|
||||
return fmt.Sprintf("InstanceType(%d)", i)
|
||||
}
|
||||
return _InstanceType_name[_InstanceType_index[i]:_InstanceType_index[i+1]]
|
||||
|
@ -9,7 +9,7 @@ const _walkOperation_name = "walkInvalidwalkInputwalkApplywalkPlanwalkPlanDestro
|
||||
var _walkOperation_index = [...]uint8{0, 11, 20, 29, 37, 52, 63, 75}
|
||||
|
||||
func (i walkOperation) String() string {
|
||||
if i >= walkOperation(len(_walkOperation_index)-1) {
|
||||
if i+1 >= walkOperation(len(_walkOperation_index)) {
|
||||
return fmt.Sprintf("walkOperation(%d)", i)
|
||||
}
|
||||
return _walkOperation_name[_walkOperation_index[i]:_walkOperation_index[i+1]]
|
||||
|
Loading…
Reference in New Issue
Block a user