added feilds and manually fixed migration scripts
This commit is contained in:
parent
12cdfe4d5d
commit
4f05ef22a9
27
alembic/versions/16345354480e_added_config_to_test.py
Executable file
27
alembic/versions/16345354480e_added_config_to_test.py
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
"""added config to test table
|
||||||
|
|
||||||
|
Revision ID: 16345354480e
|
||||||
|
Revises: 53fcc008b313
|
||||||
|
Create Date: 2013-09-20 11:08:56.790834
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '16345354480e'
|
||||||
|
down_revision = '53fcc008b313'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('test', sa.Column('config', sa.String(length=4096), nullable=True))
|
||||||
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('test', 'config')
|
||||||
|
|
||||||
|
### end Alembic commands ###
|
@ -34,14 +34,14 @@ def upgrade():
|
|||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('test_id', sa.Integer(), nullable=True),
|
sa.Column('test_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('message', sa.String(length=1024), nullable=True),
|
sa.Column('message', sa.String(length=1024), nullable=True),
|
||||||
sa.Column('finished', sa.Boolean(), nullable=True),
|
sa.Column('finished', sa.Boolean(), nullable=False),
|
||||||
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
|
|
||||||
op.add_column(u'user', sa.Column('vendor_id', sa.Integer(), nullable=True))
|
op.add_column(u'user', sa.Column('vendor_id',sa.Integer(), nullable=True))
|
||||||
op.add_column(u'user', sa.Column('authorized', sa.Boolean(), nullable=True))
|
op.add_column(u'user', sa.Column('authorized',sa.Boolean(create_constraint=False),nullable=True ))
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,20 +76,20 @@ def clouds(args):
|
|||||||
print ''
|
print ''
|
||||||
|
|
||||||
|
|
||||||
def run(args):
|
def start(args):
|
||||||
"""run test command
|
"""start test command
|
||||||
|
|
||||||
refstack run {cloud_id} --sha {sha}
|
refstack start {cloud_id} --sha {sha}
|
||||||
|
|
||||||
triggers local run of tempest with specified cloud_id returns a
|
triggers local run of tempest with specified cloud_id returns a
|
||||||
test_id so that the user can check status or cancel the test"""
|
test_id so that the user can check status or cancel the test"""
|
||||||
print 'run triggered'
|
print 'start triggered'
|
||||||
|
|
||||||
|
|
||||||
def status(args):
|
def status(args):
|
||||||
"""get the status of a running test
|
"""get the status of a running test
|
||||||
|
|
||||||
refstack status --test-id {123}
|
refstack status {test-id}
|
||||||
"""
|
"""
|
||||||
print 'status triggered'
|
print 'status triggered'
|
||||||
|
|
||||||
@ -165,8 +165,8 @@ def subcommands(subparsers):
|
|||||||
dest='cloud_id',
|
dest='cloud_id',
|
||||||
help='The id of the cloud you want to remove')
|
help='The id of the cloud you want to remove')
|
||||||
|
|
||||||
"""argparse options for the run command """
|
"""argparse options for the start command """
|
||||||
run_parser = subparsers.add_parser('run', help='run tests on cloud')
|
start_parser = subparsers.add_parser('start', help='start tests on cloud')
|
||||||
|
|
||||||
"""argparse options for the status command """
|
"""argparse options for the status command """
|
||||||
status_parser = subparsers.add_parser('status', help='status of test')
|
status_parser = subparsers.add_parser('status', help='status of test')
|
||||||
|
@ -84,7 +84,7 @@ class Cloud(Base):
|
|||||||
admin_endpoint = Column(String(120), unique=False)
|
admin_endpoint = Column(String(120), unique=False)
|
||||||
admin_user = Column(String(80), unique=False)
|
admin_user = Column(String(80), unique=False)
|
||||||
admin_key = Column(String(80), unique=False)
|
admin_key = Column(String(80), unique=False)
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
endpoint,
|
endpoint,
|
||||||
test_user,
|
test_user,
|
||||||
@ -108,22 +108,20 @@ class Test(Base):
|
|||||||
cloud_id = Column(Integer, ForeignKey('cloud.id'))
|
cloud_id = Column(Integer, ForeignKey('cloud.id'))
|
||||||
cloud = relationship('Cloud',
|
cloud = relationship('Cloud',
|
||||||
backref=backref('tests',lazy='dynamic'))
|
backref=backref('tests',lazy='dynamic'))
|
||||||
status = relationship("TestStatus",
|
config = Column(String(4096))
|
||||||
order_by="desc(test_status.timestamp)",
|
|
||||||
primaryjoin="TestStatus.test_id==Test.id")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestStatus(Base):
|
class TestStatus(Base):
|
||||||
__tablename__ = 'test_status'
|
__tablename__ = 'test_status'
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
test_id = Column(Integer, ForeignKey('test.id'))
|
test_id = Column(Integer, ForeignKey('test.id'))
|
||||||
|
test = relationship('Test',
|
||||||
|
backref=backref('status',lazy='dynamic'))
|
||||||
message = Column(String(1024))
|
message = Column(String(1024))
|
||||||
finished = Column(Boolean, default=False)
|
finished = Column(Boolean, default=False)
|
||||||
timestamp = Column(DateTime, default=datetime.now)
|
timestamp = Column(DateTime, default=datetime.now)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestResults(Base):
|
class TestResults(Base):
|
||||||
__tablename__ = 'test_results'
|
__tablename__ = 'test_results'
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user