#!/usr/bin/env python3
# -*- encoding: UTF8 -*-
# test_MultiSDP.py
# Tests SDP (Server Deployment Package) on Docker Compose images
# See documentation and run_tests.sh in /sdp/main/test/README.md
from __future__ import print_function
import logging
import os
import re
import sys
import unittest
import P4
from test_SDP import SDPTest_base
LOGGER_NAME = 'MultiSDPTest'
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)
class MultiSDPTest(SDPTest_base):
"Tests for multiple SDP instances on different machines"
def setUp(self):
self.setup_everything()
def testMkRepCalls(self):
"Basic mkrep options"
self.run_cmd("cp -R /sdp /p4depots/sdp")
self.sudo_cmd("rm -rf /tmp/p4")
self.run_cmd("python3 /p4/test_SDP.py --instance 1 --setup")
p4 = P4.P4()
p4.port = "1667"
p4.user = "perforce"
p4.connect()
for reptype in ["ha"]:
mkrep_cmd = "/p4/common/bin/mkrep.sh -i 1 -t %s -s bos -r replica1" % reptype
# Test for missing config file
output = self.run_cmd(mkrep_cmd)
self.assertLinePresent("FATAL: Missing site tag configuration file", output)
# Fix and try again - getting further
self.run_cmd("cp /sdp/Server/Unix/p4/common/config/SiteTags.cfg /p4/common/config/")
output = self.run_cmd(mkrep_cmd)
self.assertLinePresent("Server spec master.1 and service user will be created", output)
# svr = p4.fetch_server("master.1")
# svr["Services"] = "commit-server"
# p4.save_server(svr)
output = self.run_cmd(mkrep_cmd)
self.assertLineNotPresent("FATAL: Failed to load server spec from file", output)
self.assertLinePresent("ERROR: Protections does not grant access to group ServiceUsers as required", output)
protect = p4.fetch_protect()
protect['Protections'].append("super group ServiceUsers * //...")
p4.save_protect(protect)
output = self.run_cmd(mkrep_cmd)
self.assertLinePresent("^STEP 12", output)
# For the other replica types the errors encountered above won't recur
for reptype in "ham ro rom fr fs frm fsm ffr edge".split():
mkrep_cmd = "/p4/common/bin/mkrep.sh -i 1 -t %s -s bos -r replica1" % reptype
# Test for missing config file
output = self.run_cmd(mkrep_cmd)
self.assertLinePresent("^STEP 12", output)
self.assertLineNotPresent("FATAL:", output)
svrname = "p4d_%s_bos" % reptype
servers = [x['ServerID'] for x in p4.run_servers()]
self.assertTrue(svrname in servers)
if __name__ == "__main__":
init_logging()
testrunner = None
unittest.main(testRunner=testrunner, argv=sys.argv[:1])
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 33444 | Claude (AI Agent by Anthropic) | Initial population of r26.1.0.BETA from main. | ||
| //p4-sdp/main/Server/test/test_MultiSDP.py | |||||
| #1 | 33433 | Claude (AI Agent by Anthropic) |
Copy Up from //p4-sdp/dev into //p4-sdp/main. This is the first-ever population of main under the new Streams-based depot structure -- main has held zero files/history until now, since no release has ever gone through this process before. 463 files, covering the entire 2026.1 cycle: rebranding (SDP-1379), Secure By Default (SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version identification (SDP-1161/SDP-799), the Streams-native release process redesign itself (Task 5), the opt_perforce_sdp_backup.sh false-error fix, the P4D 2026.1 test-suite targeting, refreshed P4*.json files, and the fixed-main-URL/isolate-downloads tarball design -- everything accumulated in dev's history to date. Isolated paths (ai_dev_support/, Version, doc/*.html, doc/*.pdf, doc/gen/*.man.txt, doc/gen/sdp_install.cfg, Unsupported/doc/*.html, Unsupported/doc/*.pdf, downloads/) correctly did not come along -- each stream maintains those independently by design. Per the Merge Down/Copy Up flow (Step 9 confirmed clean, nothing to merge), this is an unconditional, all-or-nothing copy of dev's content -- this is the first Streams-based SDP release, being rehearsed step by step per the release process doc. Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic. |
||
| //p4-sdp/dev/Server/test/test_MultiSDP.py | |||||
| #2 | 33409 | Claude (AI Agent by Anthropic) |
Copy Up from //p4-sdp/dev_rebrand into //p4-sdp/dev. This is the first promotion of dev_rebrand's work into dev since dev_rebrand was created (2025-05-24) -- 303 files, covering the entire 2026.1 rebranding effort (SDP-1379), the Secure By Default adaptation (SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version identification (SDP-1161/SDP-799), and the Streams-native release process redesign (Task 5) done this session, plus everything else accumulated in dev_rebrand's history before this session. Per the Merge Down/Copy Up flow, this is intentionally a full, unconditional blast-replace of dev's content from dev_rebrand -- all selectivity/care happened in the preceding Merge Down (dev -> dev_rebrand, changes 33407-33408), which absorbed Robert Cowham's independent dev-side work first so nothing of his is lost by this Copy Up. Two files are worth calling out since they might look alarming in isolation: - tools/mdcu.sh is deleted -- intentional, retired this session in favor of the two direct Streams commands now documented in doc/ReleaseProcessOverview.md. - tools/ReleaseProcessOverview.md is deleted -- this is a stale relic of a file move dev_rebrand made back in 2025-05-24 (tools/ -> doc/) that was never previously propagated to dev; the current, fully-rewritten doc/ReleaseProcessOverview.md is added/updated correctly by this same changelist. |
||
| #1 | 31397 | C. Thomas Tyler | Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368. | ||
| //guest/perforce_software/sdp/dev/Server/test/test_MultiSDP.py | |||||
| #4 | 28226 | C. Thomas Tyler | chmod +x | ||
| #3 | 26782 | Robert Cowham |
Update tests of multiple replicas vis docker compose for mkrep.sh/ansible/loacheckpoint.sh Pre-cursor to turning on these tests as part of CI |
||
| #2 | 25554 | Robert Cowham | Automated tests for calling upgrade.sh | ||
| #1 | 25258 | Robert Cowham |
Rework the containers in preparation for multi container testing mkrep changes: Remove -c cfg option which was unused anyway Converted tabs to spaces Fixed logic error causing forwarding replicas to bail due to unsupported p4d version Standby servers require ReplicatingFrom field Add seconds to log file name (useful for testing to avoid overwriting files) |
||