
This adds a framework for upgrade testing where we split a functional test in half, running the first half on the previous commit and the second half on the current commit. This may allow us to catch upgrade errors which are otherwise difficult to find in tests because they require data generated by old/removed code. This does not run the test, since it operates on the current and prior commits, only a commit that follows this one can run the job successfully. Change-Id: I9d4d4af42fb1f684a88ec5a7e747b132423696f1
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
# Copyright 2024 Acme Gating, LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from tests.base import ZuulTestCase, iterate_timeout
|
|
|
|
|
|
class TestUpgradeNew(ZuulTestCase):
|
|
tenant_config_file = "config/single-tenant/main.yaml"
|
|
scheduler_count = 1
|
|
random_databases = False
|
|
delete_databases = True
|
|
use_tmpdir = False
|
|
init_repos = False
|
|
load_change_db = True
|
|
always_attach_logs = True
|
|
|
|
def assertFinalState(self):
|
|
# In this test, we expect to shut down in a non-final state,
|
|
# so skip these checks.
|
|
pass
|
|
|
|
def test_upgrade(self):
|
|
A = self.fake_gerrit.changes[1]
|
|
|
|
# Resume builds
|
|
for _ in iterate_timeout(60, 'wait for build'):
|
|
if self.history:
|
|
break
|
|
self.waitUntilSettled()
|
|
|
|
# This was performed in the previous run
|
|
# dict(name='project-merge', result='SUCCESS', changes='1,1'),
|
|
self.assertHistory([
|
|
dict(name='project-test1', result='SUCCESS', changes='1,1'),
|
|
dict(name='project-test2', result='SUCCESS', changes='1,1'),
|
|
], ordered=False)
|
|
self.assertEqual(len(self.builds), 0)
|
|
|
|
self.assertEqual(A.data['status'], 'MERGED')
|
|
self.assertEqual(A.reported, 2)
|
|
# Make sure all 3 jobs are in the report.
|
|
self.assertIn('project-merge', A.messages[-1])
|
|
self.assertIn('project-test1', A.messages[-1])
|
|
self.assertIn('project-test2', A.messages[-1])
|