@@ -61,6 +61,8 @@ func TestMain(m *testing.M) {
6161func TestRunStandardSolutionSchematics (t * testing.T ) {
6262 t .Parallel ()
6363
64+ enableKibana := false
65+
6466 options := testschematic .TestSchematicOptionsDefault (& testschematic.TestSchematicOptions {
6567 Testing : t ,
6668 TarIncludePatterns : []string {
@@ -93,7 +95,6 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
9395 },
9496 },
9597 }
96-
9798 options .TerraformVars = []testschematic.TestSchematicTerraformVar {
9899 {Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
99100 {Name : "access_tags" , Value : permanentResources ["accessTags" ], DataType : "list(string)" },
@@ -109,11 +110,44 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
109110 {Name : "admin_pass" , Value : GetRandomAdminPassword (t ), DataType : "string" },
110111 {Name : "admin_pass_secrets_manager_secret_group" , Value : options .Prefix , DataType : "string" },
111112 {Name : "admin_pass_secrets_manager_secret_name" , Value : options .Prefix , DataType : "string" },
112- {Name : "enable_kibana_dashboard" , Value : true , DataType : "bool" },
113+ {Name : "enable_kibana_dashboard" , Value : enableKibana , DataType : "bool" },
113114 {Name : "provider_visibility" , Value : "private" , DataType : "string" },
114115 {Name : "prefix" , Value : options .Prefix , DataType : "string" },
115116 {Name : "admin_pass" , Value : GetRandomAdminPassword (t ), DataType : "string" },
116117 }
118+
119+ if enableKibana {
120+ existingProjectID := os .Getenv ("EXISTING_CODE_ENGINE_PROJECT_ID" )
121+ kibanaImageSecret := os .Getenv ("KIBANA_IMAGE_SECRET" )
122+ kibanaRegistryUsername := os .Getenv ("KIBANA_REGISTRY_USERNAME" )
123+ kibanaRegistryToken := os .Getenv ("KIBANA_REGISTRY_PERSONAL_ACCESS_TOKEN" )
124+ kibanaRegistryServer := os .Getenv ("KIBANA_REGISTRY_SERVER" )
125+
126+ if existingProjectID == "" {
127+ t .Fatal ("existing_code_engine_project_id env var must be set when enable_kibana_dashboard is true" )
128+ }
129+ if kibanaImageSecret == "" {
130+ t .Fatal ("kibana_image_secret env var must be set when enable_kibana_dashboard is true" )
131+ }
132+ if kibanaRegistryUsername == "" {
133+ t .Fatal ("kibana_registry_username env var must be set when enable_kibana_dashboard is true" )
134+ }
135+ if kibanaRegistryToken == "" {
136+ t .Fatal ("kibana_personal_access_token env var must be set when enable_kibana_dashboard is true" )
137+ }
138+ if kibanaRegistryServer == "" {
139+ t .Fatal ("kibana_registry_server env var must be set when enable_kibana_dashboard is true" )
140+ }
141+
142+ options .TerraformVars = append (options .TerraformVars ,
143+ testschematic.TestSchematicTerraformVar {Name : "existing_code_engine_project_id" , Value : existingProjectID , DataType : "string" },
144+ testschematic.TestSchematicTerraformVar {Name : "kibana_image_secret" , Value : kibanaImageSecret , DataType : "string" },
145+ testschematic.TestSchematicTerraformVar {Name : "kibana_registry_username" , Value : kibanaRegistryUsername , DataType : "string" },
146+ testschematic.TestSchematicTerraformVar {Name : "kibana_registry_personal_access_token" , Value : kibanaRegistryToken , DataType : "string" },
147+ testschematic.TestSchematicTerraformVar {Name : "kibana_registry_server" , Value : kibanaRegistryServer , DataType : "string" },
148+ )
149+ }
150+
117151 err := options .RunSchematicTest ()
118152 assert .Nil (t , err , "This should not have errored" )
119153}
0 commit comments