← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1539402] [NEW] Refactoring required in nova/tests/unit/db/test_migrations.py

 

Public bug reported:

In nova/tests/unit/db/test_migrations.py,

We can use constant for Text, String, Integer, DateTime type constant
like

    Text_TYPE = sqlalchemy.types.Text
    String_TYPE = sqlalchemy.types.String
    Integer_TYPE = sqlalchemy.types.Integer
    DateTime_TYPE = sqlalchemy.types.DateTime


Currently it is directly used as 

        self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                              sqlalchemy.type.Text)
        self.assertIsInstance(key_pairs.c.type.type,
                              sqlalchemy.types.String)
        self.assertIsInstance(pci_devices.c.numa_node.type,
                              sqlalchemy.types.Integer)
        self.assertIsInstance(services.c.last_seen_up.type,
                              sqlalchemy.types.DateTime)

It should be

        self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                              self.Text_TYPE)
         self.assertIsInstance(shadow_pci_devices.c.parent_addr.type,
                              self.String_TYPE)
        self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                              self.Integer_TYPE)
        self.assertIsInstance(shadow_services.c.last_seen_up.type,
                              self.DateTime_TYPE)


These changes are suggested in a separate bug (https://bugs.launchpad.net/cinder/+bug/1528989) for cinder and I found them in Nova too. Updating for a better visibility of the code.

** Affects: nova
     Importance: Undecided
     Assignee: Mark (rocky-asdf)
         Status: New


** Tags: compute nova

** Changed in: nova
     Assignee: (unassigned) => Mark (rocky-asdf)

** Tags added: nova

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1539402

Title:
  Refactoring required in nova/tests/unit/db/test_migrations.py

Status in OpenStack Compute (nova):
  New

Bug description:
  In nova/tests/unit/db/test_migrations.py,

  We can use constant for Text, String, Integer, DateTime type constant
  like

      Text_TYPE = sqlalchemy.types.Text
      String_TYPE = sqlalchemy.types.String
      Integer_TYPE = sqlalchemy.types.Integer
      DateTime_TYPE = sqlalchemy.types.DateTime

  
  Currently it is directly used as 

          self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                                sqlalchemy.type.Text)
          self.assertIsInstance(key_pairs.c.type.type,
                                sqlalchemy.types.String)
          self.assertIsInstance(pci_devices.c.numa_node.type,
                                sqlalchemy.types.Integer)
          self.assertIsInstance(services.c.last_seen_up.type,
                                sqlalchemy.types.DateTime)

  It should be

          self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                                self.Text_TYPE)
           self.assertIsInstance(shadow_pci_devices.c.parent_addr.type,
                                self.String_TYPE)
          self.assertIsInstance(shadow_instance_extra.c.vcpu_model.type,
                                self.Integer_TYPE)
          self.assertIsInstance(shadow_services.c.last_seen_up.type,
                                self.DateTime_TYPE)

  
  These changes are suggested in a separate bug (https://bugs.launchpad.net/cinder/+bug/1528989) for cinder and I found them in Nova too. Updating for a better visibility of the code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1539402/+subscriptions


Follow ups