def setup_class(cls, complete_check=True): check = super().setup_class(complete_check=False) unit = unit_run() option.temp_dir = unit['temp_dir'] TestFeatureIsolation().check(option.available, unit['temp_dir']) assert unit_stop() is None shutil.rmtree(unit['temp_dir']) return check if not complete_check else check()
def test_static_migration(self, skip_fds_check, temp_dir): skip_fds_check(True, True, True) def set_conf_version(path, version): with open(path, 'w+') as f: f.write(str(version)) with open(temp_dir + '/state/version', 'r') as f: assert int(f.read().rstrip()) > 12500, 'current version' assert 'success' in self.conf( {"share": temp_dir + "/assets"}, 'routes/0/action' ), 'configure migration 12500' shutil.copytree(temp_dir + '/state', temp_dir + '/state_copy_12500') set_conf_version(temp_dir + '/state_copy_12500/version', 12500) assert 'success' in self.conf( {"share": temp_dir + "/assets$uri"}, 'routes/0/action' ), 'configure migration 12600' shutil.copytree(temp_dir + '/state', temp_dir + '/state_copy_12600') set_conf_version(temp_dir + '/state_copy_12600/version', 12600) assert 'success' in self.conf( {"share": temp_dir + "/assets"}, 'routes/0/action' ), 'configure migration no version' shutil.copytree( temp_dir + '/state', temp_dir + '/state_copy_no_version' ) os.remove(temp_dir + '/state_copy_no_version/version') unit_stop() unit_run(temp_dir + '/state_copy_12500') assert self.get(url='/')['body'] == '0123456789', 'before 1.26.0' unit_stop() unit_run(temp_dir + '/state_copy_12600') assert self.get(url='/')['body'] == '0123456789', 'after 1.26.0' unit_stop() unit_run(temp_dir + '/state_copy_no_version') assert self.get(url='/')['body'] == '0123456789', 'before 1.26.0 2'