Skip to content

Commit bcd4860

Browse files
authored
test: added flow logs test case (#992)
1 parent 8c26e4a commit bcd4860

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/pr_test.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,49 @@ func TestFullyConfigurable(t *testing.T) {
248248
assert.Nil(t, err, "This should not have errored")
249249
}
250250

251+
func TestFullyConfigurableWithFlowLogs(t *testing.T) {
252+
t.Parallel()
253+
254+
// Verify ibmcloud_api_key variable is set
255+
checkVariable := "TF_VAR_ibmcloud_api_key"
256+
val, present := os.LookupEnv(checkVariable)
257+
require.True(t, present, checkVariable+" environment variable not set")
258+
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")
259+
260+
prefix := "vpc-da-fl"
261+
262+
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
263+
Testing: t,
264+
Prefix: prefix,
265+
TarIncludePatterns: []string{
266+
"*.tf",
267+
"dynamic_values/*.tf",
268+
"dynamic_values/config_modules/*/*.tf",
269+
fullyConfigFlavorDir + "/*.tf",
270+
},
271+
TemplateFolder: fullyConfigFlavorDir,
272+
Tags: []string{"vpc-da-test"},
273+
DeleteWorkspaceOnFail: false,
274+
WaitJobCompleteMinutes: 120,
275+
})
276+
277+
options.TerraformVars = []testschematic.TestSchematicTerraformVar{
278+
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
279+
{Name: "existing_resource_group_name", Value: resourceGroup, DataType: "string"},
280+
{Name: "region", Value: options.Region, DataType: "string"},
281+
{Name: "resource_tags", Value: options.Tags, DataType: "list(string)"},
282+
{Name: "access_tags", Value: permanentResources["accessTags"], DataType: "list(string)"},
283+
{Name: "prefix", Value: options.Prefix, DataType: "string"},
284+
{Name: "enable_vpc_flow_logs", Value: "true", DataType: "bool"},
285+
{Name: "existing_cos_instance_crn", Value: permanentResources["general_test_storage_cos_instance_crn"], DataType: "string"},
286+
{Name: "kms_encryption_enabled_bucket", Value: "true", DataType: "bool"},
287+
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
288+
}
289+
290+
err := options.RunSchematicTest()
291+
assert.Nil(t, err, "This should not have errored")
292+
}
293+
251294
// Test the upgrade of fully-configurable DA with defaults
252295
func TestRunUpgradeFullyConfigurable(t *testing.T) {
253296
t.Parallel()

0 commit comments

Comments
 (0)