|
8 | 8 |
|
9 | 9 | describe 'deployments table' do
|
10 | 10 | it 'degenerate record is removed from deployments' do
|
11 |
| - db[:deployments].insert( |
12 |
| - guid: 'bommel', |
13 |
| - original_web_process_instance_count: 1, |
14 |
| - status_reason: 'DEGENERATE' |
15 |
| - ) |
| 11 | + db[:deployments].insert(guid: 'deployed_guid', original_web_process_instance_count: 1, status_reason: 'DEPLOYED') |
| 12 | + db[:deployment_processes].insert(guid: 'deployed_process_guid', deployment_guid: 'deployed_guid') |
| 13 | + db[:deployment_annotations].insert(guid: 'deployed_annotation_guid', resource_guid: 'deployed_guid') |
| 14 | + db[:deployment_labels].insert(guid: 'deployed_label_guid', resource_guid: 'deployed_guid') |
| 15 | + |
| 16 | + db[:deployments].insert(guid: 'degenerate_guid', original_web_process_instance_count: 1, status_reason: 'DEGENERATE') |
| 17 | + db[:deployment_processes].insert(guid: 'degenerate_process_guid', deployment_guid: 'degenerate_guid') |
| 18 | + db[:deployment_annotations].insert(guid: 'degenerate_annotation_guid', resource_guid: 'degenerate_guid') |
| 19 | + db[:deployment_labels].insert(guid: 'degenerate_label_guid', resource_guid: 'degenerate_guid') |
| 20 | + |
| 21 | + expect { db[:deployments].where(guid: 'degenerate_guid').delete }.to raise_error(Sequel::ForeignKeyConstraintViolation) |
16 | 22 |
|
17 | 23 | expect { Sequel::Migrator.run(db, migration_to_test, allow_missing_migration_files: true) }.not_to raise_error
|
18 |
| - deployment = db[:deployments].first(status_reason: 'DEGENERATE') |
19 |
| - expect(deployment).to be_nil |
| 24 | + |
| 25 | + expect(db[:deployments].where(status_reason: 'DEGENERATE').count).to eq(0) |
| 26 | + |
| 27 | + expect(db[:deployments].first(guid: 'degenerate_guid')).to be_nil |
| 28 | + expect(db[:deployment_processes].first(guid: 'degenerate_process_guid')).to be_nil |
| 29 | + expect(db[:deployment_annotations].first(guid: 'degenerate_annotation_guid')).to be_nil |
| 30 | + expect(db[:deployment_labels].first(guid: 'degenerate_label_guid')).to be_nil |
| 31 | + |
| 32 | + expect(db[:deployments].first(guid: 'deployed_guid')).not_to be_nil |
| 33 | + expect(db[:deployment_processes].first(guid: 'deployed_process_guid')).not_to be_nil |
| 34 | + expect(db[:deployment_annotations].first(guid: 'deployed_annotation_guid')).not_to be_nil |
| 35 | + expect(db[:deployment_labels].first(guid: 'deployed_label_guid')).not_to be_nil |
20 | 36 | end
|
21 | 37 | end
|
22 | 38 | end
|
0 commit comments