added feilds and manually fixed migration scripts

This commit is contained in:
David Lenwell 2013-10-04 02:13:07 -07:00
parent 12cdfe4d5d
commit 4f05ef22a9
4 changed files with 41 additions and 16 deletions

View 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 ###

View File

@ -34,14 +34,14 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('test_id', sa.Integer(), 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.ForeignKeyConstraint(['test_id'], ['test.id'], ),
sa.PrimaryKeyConstraint('id')
)
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('vendor_id',sa.Integer(), nullable=True))
op.add_column(u'user', sa.Column('authorized',sa.Boolean(create_constraint=False),nullable=True ))
### end Alembic commands ###

View File

@ -76,20 +76,20 @@ def clouds(args):
print ''
def run(args):
"""run test command
def start(args):
"""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
test_id so that the user can check status or cancel the test"""
print 'run triggered'
print 'start triggered'
def status(args):
"""get the status of a running test
refstack status --test-id {123}
refstack status {test-id}
"""
print 'status triggered'
@ -165,8 +165,8 @@ def subcommands(subparsers):
dest='cloud_id',
help='The id of the cloud you want to remove')
"""argparse options for the run command """
run_parser = subparsers.add_parser('run', help='run tests on cloud')
"""argparse options for the start command """
start_parser = subparsers.add_parser('start', help='start tests on cloud')
"""argparse options for the status command """
status_parser = subparsers.add_parser('status', help='status of test')

View File

@ -84,7 +84,7 @@ class Cloud(Base):
admin_endpoint = Column(String(120), unique=False)
admin_user = Column(String(80), unique=False)
admin_key = Column(String(80), unique=False)
def __init__(self,
endpoint,
test_user,
@ -108,22 +108,20 @@ class Test(Base):
cloud_id = Column(Integer, ForeignKey('cloud.id'))
cloud = relationship('Cloud',
backref=backref('tests',lazy='dynamic'))
status = relationship("TestStatus",
order_by="desc(test_status.timestamp)",
primaryjoin="TestStatus.test_id==Test.id")
config = Column(String(4096))
class TestStatus(Base):
__tablename__ = 'test_status'
id = Column(Integer, primary_key=True)
test_id = Column(Integer, ForeignKey('test.id'))
test = relationship('Test',
backref=backref('status',lazy='dynamic'))
message = Column(String(1024))
finished = Column(Boolean, default=False)
timestamp = Column(DateTime, default=datetime.now)
class TestResults(Base):
__tablename__ = 'test_results'
id = Column(Integer, primary_key=True)