예제 #1
0
    def validate_exist_entry_audit_period_values(
            self, expected_audit_period_ending,
            expected_audit_period_beginning, event_exist_server=None):
        """
        @summary: Validate that the Exist entry will have all expected values
         related to audit periods
        @param expected_audit_period_ending: The expected audit period ending
            of the server
        @type expected_audit_period_ending: datetime
        @param expected_audit_period_beginning: The expected audit period
            beginning of the server
        @type expected_audit_period_beginning: datetime
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        """
        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_ending),
            string_to_datetime(self.event_exist_server.audit_period_ending),
            timedelta(seconds=self.leeway)))
        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_beginning),
            string_to_datetime(self.event_exist_server.audit_period_beginning),
            timedelta(seconds=self.leeway)))
        self.assertTrue(EqualityTools.are_datetimes_equal(
            string_to_datetime(expected_audit_period_ending),
            string_to_datetime(self.event_exist_server.received),
            timedelta(seconds=self.leeway)))
    def test_delete_entry_fields_on_delete_server_response(self):
        """
        Verify that the Delete entry will have all expected fields
        after Server Delete
        """

        self.assertEqual(self.deleted_server.id, self.event_delete.instance,
                         self.msg.format("instance",
                                         self.deleted_server.id,
                                         self.event_delete.instance,
                                         self.delete_response.reason,
                                         self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at_created_server),
                string_to_datetime(self.event_delete.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at_created_server,
                            self.event_delete.launched_at,
                            self.delete_response.reason,
                            self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.deleted_at),
                string_to_datetime(self.event_delete.deleted_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("deleted_at",
                            self.deleted_at,
                            self.event_delete.deleted_at,
                            self.delete_response.reason,
                            self.delete_response.content))
예제 #3
0
    def test_delete_entry_fields_on_delete_server_response(self):
        """
        Verify that the Delete entry will have all expected fields
        after Server Delete
        """

        self.assertEqual(
            self.deleted_server.id, self.event_delete.instance,
            self.msg.format("instance", self.deleted_server.id,
                            self.event_delete.instance,
                            self.delete_response.reason,
                            self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at_created_server),
                string_to_datetime(self.event_delete.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at", self.launched_at_created_server,
                            self.event_delete.launched_at,
                            self.delete_response.reason,
                            self.delete_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.deleted_at),
                string_to_datetime(self.event_delete.deleted_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("deleted_at", self.deleted_at,
                            self.event_delete.deleted_at,
                            self.delete_response.reason,
                            self.delete_response.content))
 def test_exists_entry_fields_on_rescue_server_response(self):
     """
     Verify that the Exist entry will have all expected fields
     after Server Rescue
     """
     self.validate_exist_entry_field_values(server=self.unrescued_server)
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.audit_period_ending),
             timedelta(seconds=self.leeway),
         )
     )
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.audit_period_beginning),
             string_to_datetime(self.event_exist.audit_period_beginning),
             timedelta(seconds=self.leeway),
         )
     )
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.received),
             timedelta(seconds=self.leeway),
         )
     )
 def test_exists_entry_fields_on_rescue_server_response(self):
     """
     Verify that the Exist entry will have all expected fields
     after Server Rescue
     """
     self.validate_exist_entry_field_values(server=self.unrescued_server)
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.audit_period_ending),
             timedelta(seconds=self.leeway)))
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.audit_period_beginning),
             string_to_datetime(self.event_exist.audit_period_beginning),
             timedelta(seconds=self.leeway)))
     self.assertTrue(
         EqualityTools.are_datetimes_equal(
             string_to_datetime(self.rescue_start_time),
             string_to_datetime(self.event_exist.received),
             timedelta(seconds=self.leeway)))
예제 #6
0
    def validate_exist_entry_audit_period_values(
            self,
            expected_audit_period_ending,
            expected_audit_period_beginning,
            event_exist_server=None):
        """
        @summary: Validate that the Exist entry will have all expected values
         related to audit periods
        @param expected_audit_period_ending: The expected audit period ending
            of the server
        @type expected_audit_period_ending: datetime
        @param expected_audit_period_beginning: The expected audit period
            beginning of the server
        @type expected_audit_period_beginning: datetime
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        """
        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(expected_audit_period_ending),
                string_to_datetime(
                    self.event_exist_server.audit_period_ending),
                timedelta(seconds=self.leeway)))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(expected_audit_period_beginning),
                string_to_datetime(
                    self.event_exist_server.audit_period_beginning),
                timedelta(seconds=self.leeway)))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(expected_audit_period_ending),
                string_to_datetime(self.event_exist_server.received),
                timedelta(seconds=self.leeway)))
예제 #7
0
    def validate_exist_entry_field_values(self,
                                          server,
                                          event_exist_server=None,
                                          expected_flavor_ref=None,
                                          launched_at=None):
        """
        @summary: Validate that the Exist entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """

        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(
            server.id, self.event_exist_server.instance,
            self.msg.format("instance", self.created_server.id,
                            self.event_exist_server.instance,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertEqual(
            server.flavor.id, self.event_exist_server.instance_type_id,
            self.msg.format("instance_type_id", self.created_server.flavor.id,
                            self.event_exist_server.instance_type_id,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertEqual(
            self.expected_flavor_ref, self.event_exist_server.instance_type_id,
            self.msg.format("instance_type_id", self.expected_flavor_ref,
                            self.event_exist_server.instance_type_id,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertEqual(
            self.expected_flavor_ref,
            self.event_exist_server.instance_flavor_id,
            self.msg.format("instance_flavor_id", self.expected_flavor_ref,
                            self.event_exist_server.instance_flavor_id,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertIn(
            self.event_exist_server.status, ['pending', 'verified'],
            self.msg.format("status", "Not None, Empty or unexpected value",
                            self.event_exist_server.status,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertIn(
            self.event_exist_server.send_status, [0, 201],
            self.msg.format("send_status",
                            "Not None, Empty or unexpected value",
                            self.event_exist_server.status,
                            self.exist_response.reason,
                            self.exist_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_exist_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at", self.launched_at,
                            self.event_exist_server.launched_at,
                            self.exist_response.reason,
                            self.exist_response.content))
예제 #8
0
    def validate_launch_entry_field_values(self,
                                           server,
                                           event_launch_server=None,
                                           expected_flavor_ref=None,
                                           launched_at=None):
        """
        @summary: Validate that the Launch entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_launch_server: Details of the event Launch from DB
        @type event_launch_server: ServerLaunch
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """
        self.event_launch_server = self.event_launch
        if event_launch_server:
            self.event_launch_server = event_launch_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(
            server.id, self.event_launch_server.instance,
            self.msg.format("instance", server.id,
                            self.event_launch_server.instance,
                            self.launch_response.reason,
                            self.launch_response.content))
        self.assertEqual(
            server.flavor.id, self.event_launch_server.instance_type_id,
            self.msg.format("instance_type_id", server.flavor.id,
                            self.event_launch_server.instance_type_id,
                            self.launch_response.reason,
                            self.launch_response.content))
        self.assertEqual(
            self.expected_flavor_ref,
            self.event_launch_server.instance_type_id,
            self.msg.format("instance_type_id", self.expected_flavor_ref,
                            self.event_launch_server.instance_type_id,
                            self.launch_response.reason,
                            self.launch_response.content))
        self.assertEqual(
            self.expected_flavor_ref,
            self.event_launch_server.instance_flavor_id,
            self.msg.format("instance_flavor_id", self.expected_flavor_ref,
                            self.event_launch_server.instance_flavor_id,
                            self.launch_response.reason,
                            self.launch_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_launch_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at", self.launched_at,
                            self.event_launch_server.launched_at,
                            self.launch_response.reason,
                            self.launch_response.content))
예제 #9
0
    def validate_exist_entry_field_values(self, server,
                                          event_exist_server=None,
                                          expected_flavor_ref=None,
                                          launched_at=None):
        """
        @summary: Validate that the Exist entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_exist_server: Details of the event Exist from DB
        @type event_exist_server: ServerExists
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """

        self.event_exist_server = self.event_exist
        if event_exist_server:
            self.event_exist_server = event_exist_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(server.id, self.event_exist_server.instance,
                         self.msg.format("instance",
                                         self.created_server.id,
                                         self.event_exist_server.instance,
                                         self.exist_response.reason,
                                         self.exist_response.content))
        self.assertEqual(server.flavor.id,
                         self.event_exist_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.created_server.flavor.id,
                             self.event_exist_server.instance_type_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_exist_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.expected_flavor_ref,
                             self.event_exist_server.instance_type_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_exist_server.instance_flavor_id,
                         self.msg.format(
                             "instance_flavor_id",
                             self.expected_flavor_ref,
                             self.event_exist_server.instance_flavor_id,
                             self.exist_response.reason,
                             self.exist_response.content))
        self.assertIn(self.event_exist_server.status, ['pending', 'verified'],
                      self.msg.format("status",
                                      "Not None, Empty or unexpected value",
                                      self.event_exist_server.status,
                                      self.exist_response.reason,
                                      self.exist_response.content))
        self.assertIn(self.event_exist_server.send_status, [0, 201],
                      self.msg.format("send_status",
                                      "Not None, Empty or unexpected value",
                                      self.event_exist_server.status,
                                      self.exist_response.reason,
                                      self.exist_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_exist_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at,
                            self.event_exist_server.launched_at,
                            self.exist_response.reason,
                            self.exist_response.content))
예제 #10
0
    def validate_launch_entry_field_values(self, server,
                                           event_launch_server=None,
                                           expected_flavor_ref=None,
                                           launched_at=None):
        """
        @summary: Validate that the Launch entry will have all expected values
        @param server: Details of the server created in test
        @type server: Server
        @param event_launch_server: Details of the event Launch from DB
        @type event_launch_server: ServerLaunch
        @param expected_flavor_ref: The expected flavor to verify against
        @type expected_flavor_ref: String
        @param launched_at: The launched_at time of the server
        @type launched_at: datetime
        """
        self.event_launch_server = self.event_launch
        if event_launch_server:
            self.event_launch_server = event_launch_server

        self.expected_flavor_ref = self.flavor_ref
        if expected_flavor_ref:
            self.expected_flavor_ref = expected_flavor_ref

        self.launched_at = self.launched_at_created_server
        if launched_at:
            self.launched_at = launched_at

        self.assertEqual(server.id,
                         self.event_launch_server.instance,
                         self.msg.format(
                             "instance",
                             server.id,
                             self.event_launch_server.instance,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(server.flavor.id,
                         self.event_launch_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             server.flavor.id,
                             self.event_launch_server.instance_type_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_launch_server.instance_type_id,
                         self.msg.format(
                             "instance_type_id",
                             self.expected_flavor_ref,
                             self.event_launch_server.instance_type_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertEqual(self.expected_flavor_ref,
                         self.event_launch_server.instance_flavor_id,
                         self.msg.format(
                             "instance_flavor_id",
                             self.expected_flavor_ref,
                             self.event_launch_server.instance_flavor_id,
                             self.launch_response.reason,
                             self.launch_response.content))
        self.assertTrue(
            EqualityTools.are_datetimes_equal(
                string_to_datetime(self.launched_at),
                string_to_datetime(self.event_launch_server.launched_at),
                timedelta(seconds=self.leeway)),
            self.msg.format("launched_at",
                            self.launched_at,
                            self.event_launch_server.launched_at,
                            self.launch_response.reason,
                            self.launch_response.content))