Use minimal image wherever possible

This changes most of the tests to use minimal image. There are
now two tests left that use fedora image.

[1] SoftwareConfigIntegrationTest.test_server_software_config
[2] CfnInitIntegrationTest.test_server_cfn_init

Out of which [1] is already disabled at the gate.

Change-Id: I309989de1e5584f3e345213c4b62893159365973
Related-Bug: #1628302
diff --git a/functional/test_autoscaling.py b/functional/test_autoscaling.py
index e97ae89..5af512a 100644
--- a/functional/test_autoscaling.py
+++ b/functional/test_autoscaling.py
@@ -34,7 +34,8 @@
   "Parameters" : {"size": {"Type": "String", "Default": "1"},
                   "AZ": {"Type": "String", "Default": "nova"},
                   "image": {"Type": "String"},
-                  "flavor": {"Type": "String"}},
+                  "flavor": {"Type": "String"},
+                  "user_data": {"Type": "String", "Default": "jsconfig data"}},
   "Resources": {
     "JobServerGroup": {
       "Type" : "AWS::AutoScaling::AutoScalingGroup",
@@ -53,7 +54,7 @@
         "ImageId"           : {"Ref": "image"},
         "InstanceType"      : {"Ref": "flavor"},
         "SecurityGroups"    : [ "sg-1" ],
-        "UserData"          : "jsconfig data"
+        "UserData"          : {"Ref": "user_data"}
       }
     }
   },
@@ -79,7 +80,7 @@
   random1:
     type: OS::Heat::RandomString
     properties:
-      salt: {get_param: ImageId}
+      salt: {get_param: UserData}
 outputs:
   PublicIp: {value: {get_attr: [random1, value]}}
   AvailabilityZone: {value: 'not-used11'}
@@ -116,8 +117,6 @@
 
     def setUp(self):
         super(AutoscalingGroupTest, self).setUp()
-        if not self.conf.image_ref:
-            raise self.skipException("No image configured to test")
         if not self.conf.minimal_image_ref:
             raise self.skipException("No minimal image configured to test")
         if not self.conf.instance_type:
@@ -152,7 +151,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 4,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
         stack_identifier = self.stack_create(template=self.template,
                                              files=files, environment=env)
@@ -169,7 +168,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -181,7 +180,7 @@
         # Increase min size to 5
         env2 = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                 'parameters': {'size': 5,
-                               'image': self.conf.image_ref,
+                               'image': self.conf.minimal_image_ref,
                                'flavor': self.conf.instance_type}}
         self.update_stack(stack_identifier, self.template,
                           environment=env2, files=files)
@@ -198,7 +197,7 @@
         env = {'resource_registry':
                {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': '1',
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -211,8 +210,9 @@
                 {'AWS::EC2::Instance': 'provider.yaml'},
                 'parameters': {'size': '1',
                                'AZ': 'wibble',
-                               'image': self.conf.image_ref,
-                               'flavor': self.conf.instance_type}}
+                               'image': self.conf.minimal_image_ref,
+                               'flavor': self.conf.instance_type,
+                               'user_data': 'new data'}}
         self.update_stack(stack_identifier, self.template,
                           environment=env2, files=files)
 
@@ -230,7 +230,7 @@
         files = {'provider.yaml': self.bad_instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         self.client.stacks.create(
@@ -265,7 +265,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -317,7 +317,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 4,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
         stack_identifier = self.stack_create(template=self.template,
                                              files=files, environment=env)
@@ -353,7 +353,7 @@
         size = 10
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': size,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
         stack_name = self._stack_rand_name()
         stack_identifier = self.stack_create(
@@ -424,7 +424,7 @@
         policy['MinInstancesInService'] = '1'
         policy['MaxBatchSize'] = '3'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=10,
@@ -443,7 +443,7 @@
         policy['MinInstancesInService'] = '8'
         policy['MaxBatchSize'] = '4'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=8,
@@ -458,7 +458,7 @@
         policy['MinInstancesInService'] = '0'
         policy['MaxBatchSize'] = '20'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=10,
@@ -474,7 +474,7 @@
         policy['MaxBatchSize'] = '1'
         policy['PauseTime'] = 'PT0S'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=9,
@@ -624,7 +624,7 @@
                      {'custom_lb': {'AWS::EC2::Instance': 'lb.yaml'}},
                      'AWS::EC2::Instance': 'provider.yaml'},
                     'parameters': {'size': 2,
-                                   'image': self.conf.image_ref,
+                                   'image': self.conf.minimal_image_ref,
                                    'flavor': self.conf.instance_type}}
 
     def check_instance_count(self, stack_identifier, expected):
diff --git a/functional/test_cancel_update.py b/functional/test_cancel_update.py
index c40aeb0..f6ddc07 100644
--- a/functional/test_cancel_update.py
+++ b/functional/test_cancel_update.py
@@ -41,16 +41,14 @@
 
     def setUp(self):
         super(CancelUpdateTest, self).setUp()
-        if not self.conf.image_ref:
-            raise self.skipException("No image configured to test.")
-        if not self.conf.instance_type:
-            raise self.skipException("No flavor configured to test.")
+        if not self.conf.minimal_image_ref:
+            raise self.skipException("No minimal image configured to test")
         if not self.conf.minimal_instance_type:
             raise self.skipException("No minimal flavor configured to test.")
 
     def test_cancel_update_server_with_port(self):
         parameters = {'InstanceType': self.conf.minimal_instance_type,
-                      'ImageId': self.conf.image_ref,
+                      'ImageId': self.conf.minimal_image_ref,
                       'network': self.conf.fixed_network_name}
 
         stack_identifier = self.stack_create(template=self.template,
diff --git a/functional/test_instance_group.py b/functional/test_instance_group.py
index 02a2858..e8f0309 100644
--- a/functional/test_instance_group.py
+++ b/functional/test_instance_group.py
@@ -27,7 +27,8 @@
   "Parameters" : {"size": {"Type": "String", "Default": "1"},
                   "AZ": {"Type": "String", "Default": "nova"},
                   "image": {"Type": "String"},
-                  "flavor": {"Type": "String"}},
+                  "flavor": {"Type": "String"},
+                  "user_data": {"Type": "String", "Default": "jsconfig data"}},
   "Resources": {
     "JobServerGroup": {
       "Type": "OS::Heat::InstanceGroup",
@@ -45,7 +46,7 @@
         "ImageId"           : {"Ref": "image"},
         "InstanceType"      : {"Ref": "flavor"},
         "SecurityGroups"    : [ "sg-1" ],
-        "UserData"          : "jsconfig data"
+        "UserData"          : {"Ref": "user_data"}
       }
     }
   },
@@ -71,7 +72,7 @@
   random1:
     type: OS::Heat::RandomString
     properties:
-      salt: {get_param: ImageId}
+      salt: {get_param: UserData}
 outputs:
   PublicIp:
     value: {get_attr: [random1, value]}
@@ -105,8 +106,6 @@
 
     def setUp(self):
         super(InstanceGroupTest, self).setUp()
-        if not self.conf.image_ref:
-            raise self.skipException("No image configured to test")
         if not self.conf.minimal_image_ref:
             raise self.skipException("No minimal image configured to test")
         if not self.conf.instance_type:
@@ -141,7 +140,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 4,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
         stack_identifier = self.stack_create(template=self.template,
                                              files=files, environment=env)
@@ -158,7 +157,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -170,7 +169,7 @@
         # Increase min size to 5
         env2 = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                 'parameters': {'size': 5,
-                               'image': self.conf.image_ref,
+                               'image': self.conf.minimal_image_ref,
                                'flavor': self.conf.instance_type}}
         self.update_stack(stack_identifier, self.template,
                           environment=env2, files=files)
@@ -187,7 +186,7 @@
         env = {'resource_registry':
                {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 1,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -200,8 +199,9 @@
                 {'AWS::EC2::Instance': 'provider.yaml'},
                 'parameters': {'size': '2',
                                'AZ': 'wibble',
-                               'image': self.conf.image_ref,
-                               'flavor': self.conf.instance_type}}
+                               'image': self.conf.minimal_image_ref,
+                               'flavor': self.conf.instance_type,
+                               'user_data': 'new data'}}
         self.update_stack(stack_identifier, self.template,
                           environment=env2, files=files)
 
@@ -219,7 +219,7 @@
         files = {'provider.yaml': self.bad_instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         self.client.stacks.create(
@@ -254,7 +254,7 @@
         files = {'provider.yaml': self.instance_template}
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': 2,
-                              'image': self.conf.image_ref,
+                              'image': self.conf.minimal_image_ref,
                               'flavor': self.conf.instance_type}}
 
         stack_identifier = self.stack_create(template=self.template,
@@ -323,8 +323,8 @@
         size = 5
         env = {'resource_registry': {'AWS::EC2::Instance': 'provider.yaml'},
                'parameters': {'size': size,
-                              'image': self.conf.image_ref,
-                              'flavor': self.conf.instance_type}}
+                              'image': self.conf.minimal_image_ref,
+                              'flavor': self.conf.minimal_instance_type}}
         stack_name = self._stack_rand_name()
         stack_identifier = self.stack_create(
             stack_name=stack_name,
@@ -394,7 +394,7 @@
         policy['MinInstancesInService'] = '1'
         policy['MaxBatchSize'] = '3'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=5,
@@ -414,7 +414,7 @@
         policy['MinInstancesInService'] = '4'
         policy['MaxBatchSize'] = '4'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=2,
@@ -430,7 +430,7 @@
         policy['MinInstancesInService'] = '0'
         policy['MaxBatchSize'] = '20'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=5,
@@ -447,7 +447,7 @@
         policy['MaxBatchSize'] = '2'
         policy['PauseTime'] = 'PT0S'
         config = updt_template['Resources']['JobServerConfig']
-        config['Properties']['ImageId'] = self.conf.minimal_image_ref
+        config['Properties']['UserData'] = 'new data'
 
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=3,
diff --git a/scenario/scenario_base.py b/scenario/scenario_base.py
index df86e9e..c48d64d 100644
--- a/scenario/scenario_base.py
+++ b/scenario/scenario_base.py
@@ -28,11 +28,6 @@
             raise self.skipException("No default network configured to test")
         self.net = self._get_network()
 
-        if not self.conf.image_ref:
-            raise self.skipException("No image configured to test")
-        if not self.conf.instance_type:
-            raise self.skipException("No flavor configured to test")
-
         if not self.conf.minimal_image_ref:
             raise self.skipException("No minimal image configured to test")
         if not self.conf.minimal_instance_type:
diff --git a/scenario/test_server_cfn_init.py b/scenario/test_server_cfn_init.py
index 7ed6082..c7d84e3 100644
--- a/scenario/test_server_cfn_init.py
+++ b/scenario/test_server_cfn_init.py
@@ -21,6 +21,10 @@
 
     def setUp(self):
         super(CfnInitIntegrationTest, self).setUp()
+        if not self.conf.image_ref:
+            raise self.skipException("No image configured to test")
+        if not self.conf.instance_type:
+            raise self.skipException("No flavor configured to test")
 
     def check_stack(self, sid):
         # Check status of all resources
diff --git a/scenario/test_server_signal.py b/scenario/test_server_signal.py
index de42f02..4567e43 100644
--- a/scenario/test_server_signal.py
+++ b/scenario/test_server_signal.py
@@ -24,8 +24,8 @@
         """Check a server in a created network can signal to heat."""
         parameters = {
             'key_name': self.keypair_name,
-            'flavor': self.conf.instance_type,
-            'image': self.conf.image_ref,
+            'flavor': self.conf.minimal_instance_type,
+            'image': self.conf.minimal_image_ref,
             'timeout': self.conf.build_timeout,
         }
 
diff --git a/scenario/test_server_software_config.py b/scenario/test_server_software_config.py
index ec12fda..df35042 100644
--- a/scenario/test_server_software_config.py
+++ b/scenario/test_server_software_config.py
@@ -42,6 +42,13 @@
 
 class SoftwareConfigIntegrationTest(scenario_base.ScenarioTestsBase):
 
+    def setUp(self):
+        super(SoftwareConfigIntegrationTest, self).setUp()
+        if not self.conf.image_ref:
+            raise self.skipException("No image configured to test")
+        if not self.conf.instance_type:
+            raise self.skipException("No flavor configured to test")
+
     def check_stack(self):
         sid = self.stack_identifier
         # Check that all stack resources were created