예제 #1
0
def add_gerrit_ids(test_suite):
    # Grab the Base for the previous schemga so that we have all
    # the definitions we need.
    Base = upgrade_2_to_3.get_base(test_suite)
    # Grab our db_key_name for our test suite so we can properly
    # prefix our fields/table names.
    db_key_name = test_suite.db_key_name

    class Gerrit(Base):
        __tablename__ = db_key_name + '_Gerrit'
        id = Column("ID", Integer, primary_key=True)
        order_id = Column("OrderID", Integer,
                          ForeignKey(upgrade_0_to_1.OrderField.id),
                          index=True)
        gerrit_change_id = Column("gerrit_change_id", String(256),
                                  index=True)

    class CVGerrit(Base):
        __tablename__ = db_key_name + '_CV_Gerrit'
        id = Column("ID", Integer, primary_key=True)
        order_id = Column("OrderID", Integer,
                          ForeignKey(upgrade_0_to_1.CVOrderField.id),
                          index=True)
        gerrit_change_id = Column("gerrit_change_id", String(256),
                                  index=True)
        gerrit_change_id_parent = Column("gerrit_change_id_parent",
                                         String(256), index=True)

    return Base
예제 #2
0
def add_profiles(test_suite):
    """Given a test suite with a database connection and a test-suite
    name, make the profile sqlalchemy database objects for that test-suite.
    """
    # Grab the Base for the previous schema so that we have all
    # the definitions we need.
    Base = upgrade_2_to_3.get_base(test_suite)
    # Grab our db_key_name for our test suite so we can properly
    # prefix our fields/table names.
    db_key_name = test_suite.db_key_name

    class Profile(Base):
        __tablename__ = db_key_name + '_Profile'

        id = Column("ID", Integer, primary_key=True)
        created_time = Column("CreatedTime", DateTime)
        accessed_time = Column("AccessedTime", DateTime)
        filename = Column("Filename", String(256))
        counters = Column("Counters", String(512))

    return Base
예제 #3
0
def add_profiles(test_suite):
    """Given a test suite with a database connection and a test-suite
    name, make the profile sqlalchemy database objects for that test-suite.
    """
    # Grab the Base for the previous schema so that we have all
    # the definitions we need.
    Base = upgrade_2_to_3.get_base(test_suite)
    # Grab our db_key_name for our test suite so we can properly
    # prefix our fields/table names.
    db_key_name = test_suite.db_key_name

    class Profile(Base):
        __tablename__ = db_key_name + '_Profile'
        
        id = Column("ID", Integer, primary_key=True)
        created_time = Column("CreatedTime", DateTime)
        accessed_time = Column("AccessedTime", DateTime)
        filename = Column("Filename", String(256))
        counters = Column("Counters", String(512))
    
    return Base
예제 #4
0
def add_regressions(test_suite):
    """Given a test suite with a database connection and a test-suite
    name, make the regression sqalchmey database objects for that test-suite.
    """
    # Grab the Base for the previous schema so that we have all
    # the definitions we need.
    Base = upgrade_2_to_3.get_base(test_suite)
    # Grab our db_key_name for our test suite so we can properly
    # prefix our fields/table names.

    db_key_name = test_suite.db_key_name
    # Replace the field change definition with a new one, the old table
    # is full of bad data.
    table_name = "{}_FieldChange".format(db_key_name)
    Base.metadata.remove(Base.metadata.tables[table_name])

    class FieldChange(Base):
        """FieldChange represents a change in between the values
        of the same field belonging to two samples from consecutive runs."""

        __tablename__ = db_key_name + '_FieldChangeV2'
        id = Column("ID", Integer, primary_key=True)
        old_value = Column("OldValue", Float)
        new_value = Column("NewValue", Float)
        start_order_id = Column("StartOrderID", Integer,
                                ForeignKey("%s_Order.ID" % db_key_name))
        end_order_id = Column("EndOrderID", Integer,
                              ForeignKey("%s_Order.ID" % db_key_name))
        test_id = Column("TestID", Integer,
                         ForeignKey("%s_Test.ID" % db_key_name))
        machine_id = Column("MachineID", Integer,
                            ForeignKey("%s_Machine.ID" % db_key_name))
        field_id = Column("FieldID", Integer,
                          ForeignKey(upgrade_0_to_1.SampleField.id))
        # Could be from many runs, but most recent one is interesting.
        run_id = Column("RunID", Integer,
                        ForeignKey("%s_Run.ID" % db_key_name))

    class Regression(Base):
        """Regession hold data about a set of RegressionIndicies."""

        __tablename__ = db_key_name + '_Regression'
        id = Column("ID", Integer, primary_key=True)
        title = Column("Title", String(256), unique=False, index=False)
        bug = Column("BugLink", String(256), unique=False, index=False)
        state = Column("State", Integer)

    class RegressionIndicator(Base):
        """"""
        __tablename__ = db_key_name + '_RegressionIndicator'
        id = Column("ID", Integer, primary_key=True)
        regression_id = Column("RegressionID", Integer,
                               ForeignKey("%s_Regression.ID" % db_key_name))

        field_change_id = Column(
            "FieldChangeID", Integer,
            ForeignKey("%s_FieldChangeV2.ID" % db_key_name))

    class ChangeIgnore(Base):
        """Changes to ignore in the web interface."""

        __tablename__ = db_key_name + '_ChangeIgnore'
        id = Column("ID", Integer, primary_key=True)

        field_change_id = Column(
            "ChangeIgnoreID", Integer,
            ForeignKey("%s_FieldChangeV2.ID" % db_key_name))

    return Base
예제 #5
0
def add_regressions(test_suite):
    """Given a test suite with a database connection and a test-suite
    name, make the regression sqalchmey database objects for that test-suite.
    """
    # Grab the Base for the previous schema so that we have all
    # the definitions we need.
    Base = upgrade_2_to_3.get_base(test_suite)
    # Grab our db_key_name for our test suite so we can properly
    # prefix our fields/table names.

    db_key_name = test_suite.db_key_name
    # Replace the field change definition with a new one, the old table
    # is full of bad data.
    table_name = "{}_FieldChange".format(db_key_name)
    Base.metadata.remove(Base.metadata.tables[table_name])

    class FieldChange(Base):
        """FieldChange represents a change in between the values
        of the same field belonging to two samples from consecutive runs."""

        __tablename__ = db_key_name + '_FieldChangeV2'
        id = Column("ID", Integer, primary_key=True)
        old_value = Column("OldValue", Float)
        new_value = Column("NewValue", Float)
        start_order_id = Column("StartOrderID", Integer,
                                ForeignKey("%s_Order.ID" % db_key_name))
        end_order_id = Column("EndOrderID", Integer,
                              ForeignKey("%s_Order.ID" % db_key_name))
        test_id = Column("TestID", Integer,
                         ForeignKey("%s_Test.ID" % db_key_name))
        machine_id = Column("MachineID", Integer,
                            ForeignKey("%s_Machine.ID" % db_key_name))
        field_id = Column("FieldID", Integer,
                          ForeignKey(upgrade_0_to_1.SampleField.id))
        # Could be from many runs, but most recent one is interesting.
        run_id = Column("RunID", Integer,
                        ForeignKey("%s_Run.ID" % db_key_name))

    class Regression(Base):
        """Regession hold data about a set of RegressionIndicies."""

        __tablename__ = db_key_name + '_Regression'
        id = Column("ID", Integer, primary_key=True)
        title = Column("Title", String(256), unique=False, index=False)
        bug = Column("BugLink", String(256), unique=False, index=False)
        state = Column("State", Integer)

    class RegressionIndicator(Base):
        """"""
        __tablename__ = db_key_name + '_RegressionIndicator'
        id = Column("ID", Integer, primary_key=True)
        regression_id = Column("RegressionID", Integer,
                               ForeignKey("%s_Regression.ID" % db_key_name))

        field_change_id = Column(
            "FieldChangeID", Integer,
            ForeignKey("%s_FieldChangeV2.ID" % db_key_name))

    class ChangeIgnore(Base):
        """Changes to ignore in the web interface."""

        __tablename__ = db_key_name + '_ChangeIgnore'
        id = Column("ID", Integer, primary_key=True)

        field_change_id = Column(
            "ChangeIgnoreID", Integer,
            ForeignKey("%s_FieldChangeV2.ID" % db_key_name))

    return Base