chore: unified hybrid tests enabled environment var - #4137
chore: unified hybrid tests enabled environment var#4137NoelStephensUnity wants to merge 11 commits into
Conversation
Adding an additional unified hybrid spawning test pass.
Fixed: - Issue with NetworkObject throwing an exception during hybrid integration test. - Issue with setting the active world prior to spawning a hybrid prefab during integration tests. - Issue with UnifiedNetcodeUpdateSystem not overriding the OnCreate method along with checks for a valid NetworkManager and/or transport within OnUpdate. - Issues (minor) with the original UnifiedNetworkTransformTest. - Adjustments to the NetcodeIntegrationTest that assures the correct active world is assigned when spawning.
Co-authored-by: Emma <emma.mcmillan@unity3d.com>
…est filter Unified selection now lives in C# instead: - unified-tests.yml sets UNIFIED_TESTS=true and passes no --testfilter; unified_test_filter is removed from project.metafile. - NetcodeIntegrationTest.UseUnifiedTests() (virtual, defaults to false) is the opt-in a fixture overrides to run in a unified pass. USE_CMB_SERVICE still takes precedence. - Adds IgnoreIfUnifiedTestsEnvironmentVariableSetAttribute and the matching NetcodeIntegrationTestHelpers.IgnoreIfUnifiedTestsEnvironmentVariableSet() so fixtures that do not apply under unified netcode opt out explicitly. - Applies that opt-out across the package and testproject fixtures that do not need to run against hybrid prefabs.
Removed comments regarding unified tests and their dependencies.
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop-3.x.x #4137 +/- ##
==============================================
Coverage 78.00% 78.00%
==============================================
Files 153 153
Lines 26260 26260
==============================================
Hits 20483 20483
Misses 5777 5777
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…environment-var develop-3.x.x now carries PR #4122 as a single squashed commit, so the four unified files this branch also changes conflicted against their own squashed history rather than against new work. Conflict resolutions: - .yamato/project.metafile: kept this branch's deletion of unified_test_filter. The squash reintroduced it; selection is the UNIFIED_TESTS environment variable plus NetcodeIntegrationTest.UseUnifiedTests now. - .yamato/unified-tests.yml: kept this branch's version, which is the same job with the UNIFIED_TESTS variable and no --testfilter. - .yamato/_triggers.yml: took develop-3.x.x (drops a stray blank line). - NetcodeIntegrationTest.cs: took develop-3.x.x's TODO-UNIFIED tag rename. Incoming: the SceneManagementSynchronizationTests rework that distinguishes scene events from connection events and adjusts the m_UseCmbService path, which is the CMB service test fix, plus the U-PR bot config.
There was a problem hiding this comment.
💡 Harness Review
The change introduces environment-driven selection for unified hybrid test jobs and corrects the hybrid configuration messages, but the new method-parameter filtering path cannot support the opt-in route it documents.
Reviewed commit 9c79cb9
🤖 Helpful? 👍/👎
| // Only For Unified Tests: | ||
| // Note: this cannot filter a test that takes its HostOrServer as a test method parameter, since | ||
| // the value is not known until the method runs. Those call ApplyUnifiedTestFilter themselves. | ||
| ApplyUnifiedTestFilter(); |
There was a problem hiding this comment.
This one-time filter prevents method-parameter fixtures from ever opting in. NetworkVariableTests uses the default base constructor, so m_AllPrefabsAsHybrid is false when this setup runs; with UNIFIED_TESTS=true, ApplyUnifiedTestFilter() therefore ignores the entire fixture before any [Values] HostOrServer case can call the overload. Overriding UseUnifiedTests() later would not change that, since it is only consulted for an already-hybrid case. Exempt method-parameter fixtures from the one-time filter and apply selection at test-case level (or otherwise defer the fixture decision) so a future opted-in method-parameter test can run.
🤖 Helpful? 👍/👎
Purpose of this PR
Base branch:
chore/enable-unified-hybrid-tests(#4122) — notdevelop-3.x.x— merge #4122 before this.Follow-up to #4122, which added the unified (NGO + N4E) hybrid prefab test job. That first step
selected which tests ran by passing a name pattern to UTR (
unified_test_filter). This PR replacesthat pattern with test selection defined in C#, so the YAML no longer decides what runs.
This is the first part of 3 PRs:
UniversalNetworkTransformTestis the only opt-in for 4137 ). 4137 also removes a bunch of the YAML comment verbosity along with other script file comments.What replaces the test filter from 4122. The job now sets
UNIFIED_TESTS: "true"and passes no--testfilter(
unified_test_filteris deleted fromproject.metafile).NetcodeIntegrationTestapplies threerules, all under
#if UNIFIED_NETCODE, so nothing changes when N4E is absent:IgnoredWithoutUnifiedTestsReasonNotOptedInForUnifiedTestsReasonIgnoredForUnifiedTestsReasonSupporting pieces:
ApplyUnifiedTestFilter(HostOrServer)for tests that takeHostOrServeras a test methodparameter rather than a fixture argument.
OneTimeSetupruns once per fixture and cannot see amethod parameter, so those fixtures call this themselves before starting any instances.
NetworkVariableTestsis the case in this PR.IgnoreIfUnifiedTestsEnvironmentVariableSetAttributeplusNetcodeIntegrationTestHelpers.IgnoreIfUnifiedTestsEnvironmentVariableSet()for fixtures that donot derive from
NetcodeIntegrationTest. The attribute respectsRunState.NotRunnablefirst so itcannot resurrect a test another attribute already excluded.
USE_CMB_SERVICEalways wins. Distributed authority and hybrid prefab spawning cannot be thesame run, so a CMB service pass forces unified off.
OnOneTimeTearDown.GetUnifiedTestsEnvironmentVariable()also honours aUNIFIED_TESTScompile define, which is whatmakes a local run possible without setting the variable in the editor's environment.
saying to remove the opt-out if the test is later updated to support them.
Also in here: two missing
$prefixes on interpolatedLog.Errorstrings inNetworkManager.UnifiedIsConfiguredCorrectly, which were logging a literal{nameof(NetCodeConfig)}.Jira ticket
MTT-XXXX
Changelog
Not relevant — CI and test-infrastructure only. The one runtime edit is an error-message fix in
unified code that is not yet publicly released.
Documentation
The reasoning that used to live in the
project.metafilecomment block now lives with the code itgoverns: the
UseUnifiedTestsandApplyUnifiedTestFilterXML docs explain why hybrid prefab casesare opt-in and why a method-parameter
HostOrServerneeds separate handling.Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual tests:
Manual testing done— runtime tests rebuilt and run locally; the suite is green.Automated tests:
Covered by existing automated testsThe change is itself test infrastructure, so the verification is the shape of the run rather than a
new test: in a unified pass,
UnifiedNetworkTransformTestruns and everything else reports asignored with one of the three reasons above; in a normal pass, nothing is ignored and the suite
behaves exactly as it did before this PR. Both are visible in the UTR results XML.
Does the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?Up-port
Not needed. This targets the #4122 branch on the
develop-3.x.xline, and the unified API existsonly there.
Backports
Not needed, same reason.