From c7aa914a91e0a668caff96a77d752c1618becd67 Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Fri, 14 Apr 2017 09:12:24 -0600 Subject: [PATCH] fixes failing job unit test --- traffic_ops/app/lib/Fixtures/JobAgent.pm | 3 +-- traffic_ops/app/lib/Fixtures/JobStatus.pm | 27 +---------------------- traffic_ops/app/lib/Test/TestHelper.pm | 8 ++++++- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/traffic_ops/app/lib/Fixtures/JobAgent.pm b/traffic_ops/app/lib/Fixtures/JobAgent.pm index 0fc224ebb5..01bd83abbb 100644 --- a/traffic_ops/app/lib/Fixtures/JobAgent.pm +++ b/traffic_ops/app/lib/Fixtures/JobAgent.pm @@ -34,8 +34,7 @@ sub get_definition { } sub all_fixture_names { - # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); + return keys %definition_for; } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Fixtures/JobStatus.pm b/traffic_ops/app/lib/Fixtures/JobStatus.pm index 5bab0c6bdb..68b0efaa72 100644 --- a/traffic_ops/app/lib/Fixtures/JobStatus.pm +++ b/traffic_ops/app/lib/Fixtures/JobStatus.pm @@ -26,30 +26,6 @@ my %definition_for = ( description => 'Job is queued, but has not been picked up by any agents yet' }, }, - in_progress => { - new => 'JobStatus', - using => { - id => 2, - name => 'IN_PROGRESS', - description => 'Job is being processed by agents' - }, - }, - completed => { - new => 'JobStatus', - using => { - id => 3, - name => 'COMPLETED', - description => 'Job has finished' - }, - }, - cancelled => { - new => 'JobStatus', - using => { - id => 4, - name => 'CANCELLED', - description => 'Job was cancelled' - }, - }, ); sub get_definition { @@ -58,8 +34,7 @@ sub get_definition { } sub all_fixture_names { - # sort by db name to guarantee insertion order - return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for); + return keys %definition_for; } __PACKAGE__->meta->make_immutable; diff --git a/traffic_ops/app/lib/Test/TestHelper.pm b/traffic_ops/app/lib/Test/TestHelper.pm index 3d6c566a08..90570c6e5b 100644 --- a/traffic_ops/app/lib/Test/TestHelper.pm +++ b/traffic_ops/app/lib/Test/TestHelper.pm @@ -32,6 +32,8 @@ use Fixtures::Asn; use Fixtures::Cachegroup; use Fixtures::EdgeCachegroup; use Fixtures::Job; +use Fixtures::JobAgent; +use Fixtures::JobStatus; use Fixtures::Profile; use Fixtures::Parameter; use Fixtures::ProfileParameter; @@ -111,7 +113,7 @@ sub load_core_data { $self->reset_sequence_id(); - $self->load_all_fixtures( Fixtures::Tenant->new($schema_values) ); + $self->load_all_fixtures( Fixtures::Tenant->new($schema_values) ); $self->load_all_fixtures( Fixtures::Cdn->new($schema_values) ); $self->load_all_fixtures( Fixtures::Role->new($schema_values) ); $self->load_all_fixtures( Fixtures::TmUser->new($schema_values) ); @@ -132,6 +134,8 @@ sub load_core_data { $self->load_all_fixtures( Fixtures::DeliveryserviceRegex->new($schema_values) ); $self->load_all_fixtures( Fixtures::DeliveryserviceTmuser->new($schema_values) ); $self->load_all_fixtures( Fixtures::DeliveryserviceServer->new($schema_values) ); + $self->load_all_fixtures( Fixtures::JobStatus->new($schema_values) ); + $self->load_all_fixtures( Fixtures::JobAgent->new($schema_values) ); $self->load_all_fixtures( Fixtures::Job->new($schema_values) ); } @@ -142,6 +146,8 @@ sub unload_core_data { $self->teardown($schema, 'ToExtension'); $self->teardown($schema, 'Staticdnsentry'); $self->teardown($schema, 'Job'); + $self->teardown($schema, 'JobAgent'); + $self->teardown($schema, 'JobStatus'); $self->teardown($schema, 'Log'); $self->teardown($schema, 'Asn'); $self->teardown($schema, 'DeliveryserviceTmuser');