mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-05 12:30:07 +01:00
♻️ Prevent unit tests from running concurrently
The way the testing classes are built with the singletons currently prevents various test structs from being run at the same time. I've adjusted the tests in the PHP Monitor EAP test configuration so that they are not executed concurrently. This does slow down the test suite but prevents odd crashes from individual tests interfering with other tests. It's not an ideal solution and I would like to address this in the future, but I suspect this will be rather cumbersome. Since the app does not actually suffer from this particular issue, this is something worth investigating later.
This commit is contained in:
@@ -1144,7 +1144,6 @@
|
|||||||
C46FA98A2822F08F00D78807 /* PhpConfigurationFileTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationFileTest.swift; sourceTree = "<group>"; };
|
C46FA98A2822F08F00D78807 /* PhpConfigurationFileTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpConfigurationFileTest.swift; sourceTree = "<group>"; };
|
||||||
C47015012C46D6910069AAE7 /* NVAlertExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NVAlertExtension.swift; sourceTree = "<group>"; };
|
C47015012C46D6910069AAE7 /* NVAlertExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NVAlertExtension.swift; sourceTree = "<group>"; };
|
||||||
C4709CA128524B3400088BB8 /* StatsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsView.swift; sourceTree = "<group>"; };
|
C4709CA128524B3400088BB8 /* StatsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsView.swift; sourceTree = "<group>"; };
|
||||||
C471E79228F9B1D30021E251 /* PHP Monitor.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "PHP Monitor.xctestplan"; sourceTree = "<group>"; };
|
|
||||||
C471E7AD28F9B4940021E251 /* Feature Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Feature Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
C471E7AD28F9B4940021E251 /* Feature Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Feature Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
C471E7AF28F9B4940021E251 /* InternalSwitcherTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalSwitcherTest.swift; sourceTree = "<group>"; };
|
C471E7AF28F9B4940021E251 /* InternalSwitcherTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalSwitcherTest.swift; sourceTree = "<group>"; };
|
||||||
C471E7BC28F9B90F0021E251 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
C471E7BC28F9B90F0021E251 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -1970,7 +1969,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C4E2E86828FC2FF2003B070C /* Shared */,
|
C4E2E86828FC2FF2003B070C /* Shared */,
|
||||||
C471E79228F9B1D30021E251 /* PHP Monitor.xctestplan */,
|
|
||||||
C4F7807A25D7F84B000DBC97 /* unit */,
|
C4F7807A25D7F84B000DBC97 /* unit */,
|
||||||
C471E7AE28F9B4940021E251 /* feature */,
|
C471E7AE28F9B4940021E251 /* feature */,
|
||||||
C471E7BD28F9B90F0021E251 /* ui */,
|
C471E7BD28F9B90F0021E251 /* ui */,
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO"
|
skipped = "NO"
|
||||||
parallelizable = "YES">
|
parallelizable = "NO"
|
||||||
|
testExecutionOrdering = "random">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "C4F7807825D7F84B000DBC97"
|
BlueprintIdentifier = "C4F7807825D7F84B000DBC97"
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO"
|
skipped = "YES"
|
||||||
parallelizable = "YES">
|
parallelizable = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
@@ -52,7 +53,8 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO"
|
||||||
|
parallelizable = "NO">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "C471E7AC28F9B4940021E251"
|
BlueprintIdentifier = "C471E7AC28F9B4940021E251"
|
||||||
|
|||||||
@@ -26,13 +26,8 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
<TestPlans>
|
shouldAutocreateTestPlan = "YES">
|
||||||
<TestPlanReference
|
|
||||||
reference = "container:PHP Monitor.xcodeproj/PHP Monitor.xctestplan"
|
|
||||||
default = "YES">
|
|
||||||
</TestPlanReference>
|
|
||||||
</TestPlans>
|
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ struct CaskFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func loadFromApi(_ url: URL) async -> String {
|
private static func loadFromApi(_ url: URL) async -> String {
|
||||||
if App.hasLoadedTestableConfiguration {
|
if App.hasLoadedTestableConfiguration || url.absoluteString.contains("https://raw.githubusercontent.com") {
|
||||||
return await Shell.pipe("curl -s --max-time 10 '\(url.absoluteString)'").out
|
return await Shell.pipe("curl -s --max-time 10 '\(url.absoluteString)'").out
|
||||||
} else {
|
} else {
|
||||||
return await Shell.pipe("""
|
return await Shell.pipe("""
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations" : [
|
|
||||||
{
|
|
||||||
"id" : "98F42C11-E6D2-4AD9-A5CA-40EFE44F384A",
|
|
||||||
"name" : "Configuration 1",
|
|
||||||
"options" : {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"defaultOptions" : {
|
|
||||||
"codeCoverage" : false,
|
|
||||||
"commandLineArgumentEntries" : [
|
|
||||||
{
|
|
||||||
"argument" : "--v",
|
|
||||||
"enabled" : false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environmentVariableEntries" : [
|
|
||||||
{
|
|
||||||
"enabled" : false,
|
|
||||||
"key" : "EXTREME_DOCTOR_MODE",
|
|
||||||
"value" : ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled" : false,
|
|
||||||
"key" : "SLOW_SHELL_MODE",
|
|
||||||
"value" : ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"enabled" : false,
|
|
||||||
"key" : "PAINT_PHPMON_SWIFTUI_VIEWS",
|
|
||||||
"value" : ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"targetForVariableExpansion" : {
|
|
||||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
|
||||||
"identifier" : "C41C1B3222B0097F00E7CF16",
|
|
||||||
"name" : "PHP Monitor"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"testTargets" : [
|
|
||||||
{
|
|
||||||
"parallelizable" : true,
|
|
||||||
"target" : {
|
|
||||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
|
||||||
"identifier" : "C4F7807825D7F84B000DBC97",
|
|
||||||
"name" : "Unit Tests"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"target" : {
|
|
||||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
|
||||||
"identifier" : "C471E7AC28F9B4940021E251",
|
|
||||||
"name" : "Feature Tests"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"target" : {
|
|
||||||
"containerPath" : "container:PHP Monitor.xcodeproj",
|
|
||||||
"identifier" : "C471E7BB28F9B90F0021E251",
|
|
||||||
"name" : "UI Tests"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
@@ -153,6 +153,21 @@ class TestableConfigurations {
|
|||||||
app 'PHP Monitor DEV.app', target: "PHP Monitor DEV.app"
|
app 'PHP Monitor DEV.app', target: "PHP Monitor DEV.app"
|
||||||
end
|
end
|
||||||
"""),
|
"""),
|
||||||
|
"curl -s --max-time 10 'https://raw.githubusercontent.com/nicoverbruggen/homebrew-cask/master/Casks/phpmon.rb''" :
|
||||||
|
.delayed(0.5, """
|
||||||
|
cask 'phpmon-dev' do
|
||||||
|
depends_on formula: 'gnu-sed'
|
||||||
|
|
||||||
|
version '25.08.0_1000'
|
||||||
|
sha256 '1cb147bd1b1fbd52971d90dff577465b644aee7c878f15ede57f46e8f217067a'
|
||||||
|
|
||||||
|
url 'https://github.com/nicoverbruggen/phpmon/releases/download/v6.0/phpmon-dev.zip'
|
||||||
|
name 'PHP Monitor DEV'
|
||||||
|
homepage 'https://phpmon.app'
|
||||||
|
|
||||||
|
app 'PHP Monitor DEV.app', target: "PHP Monitor DEV.app"
|
||||||
|
end
|
||||||
|
"""),
|
||||||
"/opt/homebrew/bin/brew unlink php"
|
"/opt/homebrew/bin/brew unlink php"
|
||||||
: .delayed(0.2, "OK"),
|
: .delayed(0.2, "OK"),
|
||||||
"/opt/homebrew/bin/brew unlink php@8.2"
|
"/opt/homebrew/bin/brew unlink php@8.2"
|
||||||
|
|||||||
@@ -9,8 +9,13 @@
|
|||||||
import Testing
|
import Testing
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
@Suite(.serialized)
|
||||||
struct CaskFileParserTest {
|
struct CaskFileParserTest {
|
||||||
|
|
||||||
|
init() async throws {
|
||||||
|
ActiveShell.useSystem()
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Test Files
|
// MARK: - Test Files
|
||||||
static var exampleFilePath: URL {
|
static var exampleFilePath: URL {
|
||||||
TestBundle.url(forResource: "phpmon-dev", withExtension: "rb")!
|
TestBundle.url(forResource: "phpmon-dev", withExtension: "rb")!
|
||||||
|
|||||||
@@ -9,13 +9,14 @@
|
|||||||
import Testing
|
import Testing
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
@Suite(.serialized)
|
||||||
class PhpConfigurationFileTest {
|
class PhpConfigurationFileTest {
|
||||||
|
|
||||||
static var phpIniFileUrl: URL {
|
static var phpIniFileUrl: URL {
|
||||||
return TestBundle.url(forResource: "php", withExtension: "ini")!
|
return TestBundle.url(forResource: "php", withExtension: "ini")!
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test func can_load_extension() throws {
|
@Test func can_load_extension() throws {
|
||||||
|
ActiveFileSystem.useSystem()
|
||||||
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)
|
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)
|
||||||
|
|
||||||
#expect(iniFile != nil)
|
#expect(iniFile != nil)
|
||||||
@@ -23,6 +24,7 @@ class PhpConfigurationFileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test func can_check_key_existence() throws {
|
@Test func can_check_key_existence() throws {
|
||||||
|
print(Self.phpIniFileUrl.path)
|
||||||
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
|
let iniFile = PhpConfigurationFile.from(filePath: Self.phpIniFileUrl.path)!
|
||||||
|
|
||||||
#expect(iniFile.has(key: "error_reporting"))
|
#expect(iniFile.has(key: "error_reporting"))
|
||||||
|
|||||||
@@ -9,7 +9,12 @@
|
|||||||
import Testing
|
import Testing
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
@Suite(.serialized)
|
||||||
struct PhpExtensionTest {
|
struct PhpExtensionTest {
|
||||||
|
init () async throws {
|
||||||
|
ActiveShell.useSystem()
|
||||||
|
}
|
||||||
|
|
||||||
static var phpIniFileUrl: URL {
|
static var phpIniFileUrl: URL {
|
||||||
TestBundle.url(forResource: "php", withExtension: "ini")!
|
TestBundle.url(forResource: "php", withExtension: "ini")!
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user