#!/usr/bin/env python3 # -*- encoding: UTF8 -*- # test_Upgrade.py # Tests SDP (Server Deployment Package) UPGRADES on Docker Compose images # See documentation and run_tests.sh in /sdp/main/test/README.md from __future__ import print_function import argparse import logging import os import re import sys import unittest import P4 import test_SDP from test_SDP import SDPTest_base LOGGER_NAME = 'UpgradeSDPTest' logger = logging.getLogger(LOGGER_NAME) options = None def init_logging(): global logger logger.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s:%(name)s:%(levelname)s: %(message)s') fh = logging.FileHandler('/tmp/%s.log' % LOGGER_NAME, mode='w') fh.setLevel(logging.DEBUG) fh.setFormatter(formatter) logger.addHandler(fh) test_SDP.logger = logger class UpgradeSDPTest(SDPTest_base): "Tests for SDP upgrades" def setUp(self): self.setup_everything() self.p4 = None def install_binaries(self, ver): "Acquire Helix binaries from Perforce FTP server." output = self.run_cmd("./get_helix_binaries.sh -r %s" % ver, "/p4/sdp/helix_binaries", timeout=120) self.assertLinePresent("Downloading of Perforce Helix binaries completed OK", output) def p4run(self, *args): "Run the command logging" logger.debug('p4 cmd: %s' % ",".join([str(x) for x in args])) result = self.p4.run(args) logger.debug('result: %s' % str(result)) return result def dailyBackupTest(self, instance): "Test daily backup script" jnl_counter = self.p4run('counter', 'journal')[0]['value'] logger.debug("dailyBackupTest") self.run_cmd('/p4/common/bin/daily_checkpoint.sh %s' % instance) # Quick check on log file contents log_contents = self.readLog('checkpoint.log', instance) self.assertRegex(log_contents, "Dumping to /p4/%s/checkpoints/p4_%s.ckp" % (instance, instance)) self.assertRegex(log_contents, "journal") new_jnl_counter = self.p4run('counter', 'journal')[0]['value'] self.assertEqual(int(new_jnl_counter), int(jnl_counter) + 1) def testUpgrade(self): "Basic upgrade tests" self.run_cmd("cp -R /sdp /hxdepots/sdp") self.install_binaries("r%s" % options.from_version) self.sudo_cmd("rm -rf /tmp/p4") self.run_cmd("python3 /p4/test_SDP.py --instance 1 --setup", timeout=60) p4 = P4.P4() self.p4 = p4 p4.port = "1667" p4.user = "perforce" p4.connect() p4.disconnect() self.install_binaries("r%s" % options.to_version) output = self.run_cmd("/p4/common/bin/upgrade.sh 1 -y", timeout=60) self.assertLinePresent("Could not verify the p4broker server is online", output) self.assertLinePresent("Exiting because no upgrades are needed", output) p4.connect() # Validate expected server version is running info = p4.run_info()[0] self.assertLinePresent('P4D/LINUX26X86_64/20%s' % options.to_version, info['serverVersion']) self.dailyBackupTest("1") if __name__ == "__main__": init_logging() parser = argparse.ArgumentParser(add_help=False) parser.add_argument('--from-version', default="21.1") parser.add_argument('--to-version', default="21.2") options, args = parser.parse_known_args() testrunner = None unittest.main(testRunner=testrunner, argv=sys.argv[:1] + args)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 30915 | C. Thomas Tyler |
Released SDP 2024.1.30913 (2024/11/20). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#10 | 30388 | C. Thomas Tyler |
Released SDP 2024.1.30385 (2024/06/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#9 | 30043 | C. Thomas Tyler |
Released SDP 2023.2.30041 (2023/12/22). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#8 | 29612 | C. Thomas Tyler |
Released SDP 2023.1.29610 (2023/05/25). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#7 | 29252 | C. Thomas Tyler |
Released SDP 2022.2.29250 (2022/12/08). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#6 | 28858 | C. Thomas Tyler |
Released SDP 2022.1.28855 (2022/05/27). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#5 | 28412 | C. Thomas Tyler |
Released SDP 2021.2.28410 (2021/11/24). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#4 | 28240 | C. Thomas Tyler |
Released SDP 2021.1.28238 (2021/11/12). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#3 | 27921 | C. Thomas Tyler |
Released SDP 2020.1.27919 (2021/07/19). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#2 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#1 | 25596 | C. Thomas Tyler |
Released SDP 2019.2.25594 (2019/05/02). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
//guest/perforce_software/sdp/dev/Server/test/test_Upgrade.py | |||||
#2 | 25555 | Robert Cowham | Handle new 19.1 upgrade.sh requirements | ||
#1 | 25554 | Robert Cowham | Automated tests for calling upgrade.sh |