예제 #1
0
class TestSet(BASE):

    __tablename__ = 'test_sets'

    id = sa.Column(sa.String(128), primary_key=True)
    description = sa.Column(sa.String(256))
    test_path = sa.Column(sa.String(256))
    driver = sa.Column(sa.String(128))
    additional_arguments = sa.Column(fields.ListField())
    cleanup_path = sa.Column(sa.String(128))
    meta = sa.Column(fields.JsonField())
    deployment_tags = sa.Column(ARRAY(sa.String(64)))
    test_runs_ordering_priority = sa.Column(sa.Integer)

    # list of test sets that cannot be executed simultaneously
    # with current test set
    exclusive_testsets = sa.Column(ARRAY(sa.String(128)))

    available_since_release = sa.Column(sa.String(64), default="")

    tests = relationship('Test',
                         backref='test_set',
                         order_by='Test.name',
                         cascade='delete')

    @property
    def frontend(self):
        return {'id': self.id, 'name': self.description}

    @classmethod
    def get_test_set(cls, session, test_set):
        return session.query(cls)\
            .filter_by(id=test_set)\
            .first()
예제 #2
0
class TestSet(BASE):

    __tablename__ = 'test_sets'

    id = sa.Column(sa.String(128), primary_key=True)
    description = sa.Column(sa.String(256))
    test_path = sa.Column(sa.String(256))
    driver = sa.Column(sa.String(128))
    additional_arguments = sa.Column(fields.ListField())
    cleanup_path = sa.Column(sa.String(128))
    meta = sa.Column(fields.JsonField())
    deployment_tags = sa.Column(ARRAY(sa.String(64)))

    tests = relationship('Test',
                         backref='test_set',
                         order_by='Test.name',
                         cascade='delete')

    @property
    def frontend(self):
        return {'id': self.id, 'name': self.description}

    @classmethod
    def get_test_set(cls, session, test_set):
        return session.query(cls)\
            .filter_by(id=test_set)\
            .first()
예제 #3
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'test_runs',
        sa.Column('test_set_id', sa.String(length=128), nullable=True))
    op.add_column('test_runs',
                  sa.Column('meta', fields.JsonField(), nullable=True))
    op.add_column('test_runs',
                  sa.Column('cluster_id', sa.Integer(), nullable=False))
    op.drop_column('test_runs', u'type')
    op.drop_column('test_runs', u'stats')
    op.drop_column('test_runs', u'external_id')
    op.drop_column('test_runs', u'data')
    op.alter_column('test_runs',
                    'status',
                    existing_type=sa.VARCHAR(length=128),
                    nullable=False)
    op.add_column(
        'test_sets',
        sa.Column('cleanup_path', sa.String(length=128), nullable=True))
    op.add_column('test_sets',
                  sa.Column('meta', fields.JsonField(), nullable=True))
    op.add_column('test_sets',
                  sa.Column('driver', sa.String(length=128), nullable=True))
    op.add_column(
        'test_sets',
        sa.Column('additional_arguments', fields.ListField(), nullable=True))
    op.add_column('test_sets',
                  sa.Column('test_path', sa.String(length=256), nullable=True))
    op.drop_column('test_sets', u'data')
    op.add_column('tests', sa.Column('description', sa.Text(), nullable=True))
    op.add_column('tests', sa.Column('traceback', sa.Text(), nullable=True))
    op.add_column('tests', sa.Column('step', sa.Integer(), nullable=True))
    op.add_column('tests', sa.Column('meta', fields.JsonField(),
                                     nullable=True))
    op.add_column('tests',
                  sa.Column('duration', sa.String(length=512), nullable=True))
    op.add_column('tests', sa.Column('message', sa.Text(), nullable=True))
    op.add_column('tests', sa.Column('time_taken', sa.Float(), nullable=True))
    op.drop_column('tests', u'taken')
    op.drop_column('tests', u'data')
예제 #4
0
def upgrade():
    op.create_table(
        'cluster_state',
        sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
        sa.Column('deployment_tags', postgresql.ARRAY(sa.String(length=64)),
                  nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'test_sets',
        sa.Column('id', sa.String(length=128), nullable=False),
        sa.Column('description', sa.String(length=256), nullable=True),
        sa.Column('test_path', sa.String(length=256), nullable=True),
        sa.Column('driver', sa.String(length=128), nullable=True),
        sa.Column('additional_arguments', fields.ListField(), nullable=True),
        sa.Column('cleanup_path', sa.String(length=128), nullable=True),
        sa.Column('meta', fields.JsonField(), nullable=True),
        sa.Column('deployment_tags', postgresql.ARRAY(sa.String(length=64)),
                  nullable=True),
        sa.Column('test_runs_ordering_priority', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'cluster_testing_pattern',
        sa.Column('cluster_id', sa.Integer(), nullable=False),
        sa.Column('test_set_id', sa.String(length=128), nullable=False),
        sa.Column('tests', postgresql.ARRAY(sa.String(length=512)),
                  nullable=True),
        sa.ForeignKeyConstraint(['cluster_id'], ['cluster_state.id'], ),
        sa.ForeignKeyConstraint(['test_set_id'], ['test_sets.id'], ),
        sa.PrimaryKeyConstraint('cluster_id', 'test_set_id')
    )
    op.create_table(
        'test_runs',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('status',
                  sa.Enum('running', 'finished', name='test_run_states'),
                  nullable=False),
        sa.Column('meta', fields.JsonField(), nullable=True),
        sa.Column('started_at', sa.DateTime(), nullable=True),
        sa.Column('ended_at', sa.DateTime(), nullable=True),
        sa.Column('test_set_id', sa.String(length=128), nullable=True),
        sa.Column('cluster_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['test_set_id', 'cluster_id'],
                                ['cluster_testing_pattern.test_set_id',
                                 'cluster_testing_pattern.cluster_id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'tests',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=512), nullable=True),
        sa.Column('title', sa.String(length=512), nullable=True),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column('duration', sa.String(length=512), nullable=True),
        sa.Column('message', sa.Text(), nullable=True),
        sa.Column('traceback', sa.Text(), nullable=True),
        sa.Column('status', sa.Enum('wait_running', 'running', 'failure',
                                    'success', 'error', 'stopped',
                                    'disabled', 'skipped', name='test_states'),
                  nullable=True),
        sa.Column('step', sa.Integer(), nullable=True),
        sa.Column('time_taken', sa.Float(), nullable=True),
        sa.Column('meta', fields.JsonField(), nullable=True),
        sa.Column('deployment_tags', postgresql.ARRAY(sa.String(length=64)),
                  nullable=True),
        sa.Column('test_run_id', sa.Integer(), nullable=True),
        sa.Column('test_set_id', sa.String(length=128), nullable=True),
        sa.ForeignKeyConstraint(['test_run_id'], ['test_runs.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['test_set_id'], ['test_sets.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )