Test cleanup
This commit is contained in:
1 parent
458c2af0f0
commit
fb85ab94f0
11 files changed
+66
-79
No files matched your search
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Nothing worth mentioning yet.
|
||||||
|
|
||||||
## [0.48.8] - 2026-10-07
|
## [0.48.8] - 2026-10-07
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
' per-component one-liner (calls the shared Initialize); OnNodeReady is invoked by TestSetup with stub deps (no
|
' per-component one-liner (calls the shared Initialize); OnNodeReady is invoked by TestSetup with stub deps (no
|
||||||
' AutoBind). The spec drives the device via the Test* interface functions (callFunc reaches only interface funcs).
|
' AutoBind). The spec drives the device via the Test* interface functions (callFunc reaches only interface funcs).
|
||||||
import "pkg:/components/VideoPlayerDev/VideoPlayerDev.bs"
|
import "pkg:/components/VideoPlayerDev/VideoPlayerDev.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
' intentionally empty: Initialize runs in TestSetup (at test time, when the global logger is ready), NOT at
|
' intentionally empty: Initialize runs in TestSetup (at test time, when the global logger is ready), NOT at
|
||||||
@@ -19,21 +20,7 @@ end function
|
|||||||
' TestSetup — stand up the deps the coordinator's OnNodeReady needs (no AutoBind), then run it so the device
|
' TestSetup — stand up the deps the coordinator's OnNodeReady needs (no AutoBind), then run it so the device
|
||||||
' observers (state/position/duration) and the SponsorBlock/error controllers are wired exactly as in production.
|
' observers (state/position/duration) and the SponsorBlock/error controllers are wired exactly as in production.
|
||||||
function TestSetup() as void
|
function TestSetup() as void
|
||||||
' the coordinator logs; the logger-plugin reads m.global.logger.logLevel on every Log* call. The test app doesn't
|
Tests.SetUpLoggingGlobals()
|
||||||
' always set that global (it isn't in an isolated/@only run), so ensure it exists before any coordinator code.
|
|
||||||
if m.global.logger = invalid
|
|
||||||
m.global.addField("logger", "node", false)
|
|
||||||
m.global.logger = CreateObject("roSGNode", "Logger")
|
|
||||||
end if
|
|
||||||
|
|
||||||
' LogTelemetryEvent (error reports, the playback summary on close) writes m.global.telemetry.LogEvent; stub it.
|
|
||||||
if m.global.telemetry = invalid
|
|
||||||
m.global.addField("telemetry", "node", false)
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
telemetry.addField("LogWarn", "string", false)
|
|
||||||
m.global.telemetry = telemetry
|
|
||||||
end if
|
|
||||||
|
|
||||||
Initialize() ' the real coordinator init body (m.transport, findNode children, timer observers, getHttpAgent)
|
Initialize() ' the real coordinator init body (m.transport, findNode children, timer observers, getHttpAgent)
|
||||||
|
|
||||||
@@ -49,7 +36,10 @@ function TestSetup() as void
|
|||||||
container.fullscreen = true
|
container.fullscreen = true
|
||||||
m.top.container = container
|
m.top.container = container
|
||||||
|
|
||||||
m.top.jobQueue = createObject("roSGNode", "Node")
|
' swallows the jobs the coordinator queues (JobSystem.QueueJob writes request) without running them
|
||||||
|
jobQueue = createObject("roSGNode", "Node")
|
||||||
|
jobQueue.addField("request", "assocarray", false)
|
||||||
|
m.top.jobQueue = jobQueue
|
||||||
m.top.notifications = createObject("roSGNode", "Node")
|
m.top.notifications = createObject("roSGNode", "Node")
|
||||||
m.top.preferences = createObject("roSGNode", "Node")
|
m.top.preferences = createObject("roSGNode", "Node")
|
||||||
m.top.invidious = createObject("roSGNode", "Node")
|
m.top.invidious = createObject("roSGNode", "Node")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/JobSystem/JobRequest.bs"
|
import "pkg:/components/JobSystem/JobRequest.bs"
|
||||||
import "pkg:/components/JobSystem/JobSystem.bs"
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
||||||
@@ -7,8 +8,11 @@ namespace Tests
|
|||||||
class GenerateQrCodeJobTests extends Rooibos.BaseTestSuite
|
class GenerateQrCodeJobTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function setup()
|
protected override function setup()
|
||||||
m.logger = CreateObject("roSGNode", "Logger")
|
m.logLevel = Tests.MuteLogger()
|
||||||
m.logger.logLevel = -1
|
end function
|
||||||
|
|
||||||
|
protected override function tearDown()
|
||||||
|
m.global.logger.logLevel = m.logLevel
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@describe("GenerateQrCodeJob")
|
@describe("GenerateQrCodeJob")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
||||||
import "pkg:/components/Services/Innertube/OAuth.bs"
|
import "pkg:/components/Services/Innertube/OAuth.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
@@ -9,14 +10,11 @@ namespace Tests
|
|||||||
class InnertubeRefreshTokenIntegrationTests extends Rooibos.BaseTestSuite
|
class InnertubeRefreshTokenIntegrationTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function setup()
|
protected override function setup()
|
||||||
m.logger = CreateObject("roSGNode", "Logger")
|
m.logLevel = Tests.MuteLogger()
|
||||||
m.logger.logLevel = -1
|
end function
|
||||||
' A failed refresh goes through HttpClient's retry loop, which emits a
|
|
||||||
' telemetry warning; give the stub a no-op telemetry sink to write to.
|
protected override function tearDown()
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
m.global.logger.logLevel = m.logLevel
|
||||||
telemetry.addField("LogWarn", "string", false)
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.addFields({ telemetry: telemetry })
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@describe("Innertube refresh-token terminal classification (live)")
|
@describe("Innertube refresh-token terminal classification (live)")
|
||||||
@@ -38,7 +36,7 @@ namespace Tests
|
|||||||
threw = false
|
threw = false
|
||||||
try
|
try
|
||||||
InnertubeService.AuthRefreshAccessToken(accessTokenObject, invalid)
|
InnertubeService.AuthRefreshAccessToken(accessTokenObject, invalid)
|
||||||
catch error
|
catch _error
|
||||||
threw = true
|
threw = true
|
||||||
end try
|
end try
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/JobSystem/Jobs.bs"
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
import "pkg:/components/JobSystem/JobSystem.bs"
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
||||||
@@ -7,8 +8,11 @@ namespace Tests
|
|||||||
class JobSystemTests extends Rooibos.BaseTestSuite
|
class JobSystemTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function setup()
|
protected override function setup()
|
||||||
m.logger = CreateObject("roSGNode", "Logger")
|
m.logLevel = Tests.MuteLogger()
|
||||||
m.logger.logLevel = -1
|
end function
|
||||||
|
|
||||||
|
protected override function tearDown()
|
||||||
|
m.global.logger.logLevel = m.logLevel
|
||||||
end function
|
end function
|
||||||
|
|
||||||
protected override function beforeEach()
|
protected override function beforeEach()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import "pkg:/components/Services/LoungeService/LoungeApi.bs"
|
import "pkg:/components/Services/LoungeService/LoungeApi.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
@@ -8,13 +9,11 @@ namespace Tests
|
|||||||
class LoungeRefreshTokenIntegrationTests extends Rooibos.BaseTestSuite
|
class LoungeRefreshTokenIntegrationTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function setup()
|
protected override function setup()
|
||||||
m.logger = CreateObject("roSGNode", "Logger")
|
m.logLevel = Tests.MuteLogger()
|
||||||
m.logger.logLevel = -1
|
end function
|
||||||
' LoungeApi's failure paths emit telemetry; give the stub a no-op sink to write to.
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
protected override function tearDown()
|
||||||
telemetry.addField("LogWarn", "string", false)
|
m.global.logger.logLevel = m.logLevel
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.addFields({ telemetry: telemetry })
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@describe("Lounge token-refresh recovery (live)")
|
@describe("Lounge token-refresh recovery (live)")
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
||||||
@@ -6,17 +7,7 @@ namespace Tests
|
|||||||
class HttpClientTests extends Rooibos.BaseTestSuite
|
class HttpClientTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function beforeEach()
|
protected override function beforeEach()
|
||||||
' the logger plugin reads m.global.logger; LogTelemetryEvent writes m.global.telemetry.LogEvent.
|
Tests.SetUpLoggingGlobals()
|
||||||
if m.global.logger = invalid
|
|
||||||
m.global.addField("logger", "node", false)
|
|
||||||
m.global.logger = CreateObject("roSGNode", "Logger")
|
|
||||||
end if
|
|
||||||
if m.global.telemetry = invalid
|
|
||||||
m.global.addField("telemetry", "node", false)
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.telemetry = telemetry
|
|
||||||
end if
|
|
||||||
m.global.telemetry.LogEvent = {}
|
m.global.telemetry.LogEvent = {}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace Tests
|
||||||
|
|
||||||
|
' Log* calls read m.global.logger; LogError, LogWarn and LogTelemetryEvent write fields on m.global.telemetry.
|
||||||
|
' Both are the app's own nodes, installed by their Init on first creation and shared by every suite after it.
|
||||||
|
' Telemetry never runs, so nothing is sent.
|
||||||
|
function SetUpLoggingGlobals() as void
|
||||||
|
if m.global.logger = invalid
|
||||||
|
CreateObject("roSGNode", "Logger")
|
||||||
|
end if
|
||||||
|
if m.global.telemetry = invalid
|
||||||
|
CreateObject("roSGNode", "Telemetry")
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
' For suites that drive error paths on purpose. Returns the level to restore in tearDown: the logger is shared.
|
||||||
|
function MuteLogger() as integer
|
||||||
|
SetUpLoggingGlobals()
|
||||||
|
logLevel = m.global.logger.logLevel
|
||||||
|
m.global.logger.logLevel = -1
|
||||||
|
return logLevel
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import "pkg:/components/VideoPlayerDev/PlaybackTelemetry.bs"
|
import "pkg:/components/VideoPlayerDev/PlaybackTelemetry.bs"
|
||||||
import "pkg:/components/VideoPlayerDev/TransportController.bs"
|
import "pkg:/components/VideoPlayerDev/TransportController.bs"
|
||||||
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
|
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
@@ -10,17 +11,7 @@ namespace Tests
|
|||||||
class PlaybackTelemetryTests extends Rooibos.BaseTestSuite
|
class PlaybackTelemetryTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function beforeEach()
|
protected override function beforeEach()
|
||||||
' the logger plugin reads m.global.logger; LogTelemetryEvent writes m.global.telemetry.LogEvent.
|
Tests.SetUpLoggingGlobals()
|
||||||
if m.global.logger = invalid
|
|
||||||
m.global.addField("logger", "node", false)
|
|
||||||
m.global.logger = CreateObject("roSGNode", "Logger")
|
|
||||||
end if
|
|
||||||
if m.global.telemetry = invalid
|
|
||||||
m.global.addField("telemetry", "node", false)
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.telemetry = telemetry
|
|
||||||
end if
|
|
||||||
m.playerClock = {
|
m.playerClock = {
|
||||||
ms: 0
|
ms: 0
|
||||||
TotalMilliseconds: function() as integer
|
TotalMilliseconds: function() as integer
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import "pkg:/components/VideoPlayerDev/PlaybackTelemetry.bs"
|
import "pkg:/components/VideoPlayerDev/PlaybackTelemetry.bs"
|
||||||
import "pkg:/components/VideoPlayerDev/TransportController.bs"
|
import "pkg:/components/VideoPlayerDev/TransportController.bs"
|
||||||
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
|
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -14,16 +15,7 @@ namespace Tests
|
|||||||
class PlaybackTelemetryCompletenessTests extends Rooibos.BaseTestSuite
|
class PlaybackTelemetryCompletenessTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function beforeEach()
|
protected override function beforeEach()
|
||||||
if m.global.logger = invalid
|
Tests.SetUpLoggingGlobals()
|
||||||
m.global.addField("logger", "node", false)
|
|
||||||
m.global.logger = CreateObject("roSGNode", "Logger")
|
|
||||||
end if
|
|
||||||
if m.global.telemetry = invalid
|
|
||||||
m.global.addField("telemetry", "node", false)
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.telemetry = telemetry
|
|
||||||
end if
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' ---------- inputs ----------
|
' ---------- inputs ----------
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
|
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
|
||||||
|
import "pkg:/source/tests/LoggingGlobals.bs"
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
||||||
@@ -6,17 +7,7 @@ namespace Tests
|
|||||||
class DashRouterTests extends Rooibos.BaseTestSuite
|
class DashRouterTests extends Rooibos.BaseTestSuite
|
||||||
|
|
||||||
protected override function beforeEach()
|
protected override function beforeEach()
|
||||||
' the logger plugin reads m.global.logger; LogTelemetryEvent writes m.global.telemetry.LogEvent.
|
Tests.SetUpLoggingGlobals()
|
||||||
if m.global.logger = invalid
|
|
||||||
m.global.addField("logger", "node", false)
|
|
||||||
m.global.logger = CreateObject("roSGNode", "Logger")
|
|
||||||
end if
|
|
||||||
if m.global.telemetry = invalid
|
|
||||||
m.global.addField("telemetry", "node", false)
|
|
||||||
telemetry = CreateObject("roSGNode", "Node")
|
|
||||||
telemetry.addField("LogEvent", "assocarray", false)
|
|
||||||
m.global.telemetry = telemetry
|
|
||||||
end if
|
|
||||||
m.content = CreateObject("roSGNode", "Node")
|
m.content = CreateObject("roSGNode", "Node")
|
||||||
m.content.addFields({ metadata: {}, videoLoadId: "" })
|
m.content.addFields({ metadata: {}, videoLoadId: "" })
|
||||||
player = CreateObject("roSGNode", "Node")
|
player = CreateObject("roSGNode", "Node")
|
||||||
|
|||||||
Reference in new issue
Block a user