Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test:
.PHONY: install-kernel
install-kernel:
@bin/container system stop || true
@bin/container system start --enable-kernel-install $(SYSTEM_START_OPTS)
@bin/container system start --timeout 60 --enable-kernel-install $(SYSTEM_START_OPTS)

.PHONY: coverage
coverage: init-block
Expand Down Expand Up @@ -176,7 +176,7 @@ integration: init-block
@echo Ensuring apiserver stopped before the CLI integration tests...
@bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh
@echo Running the integration tests...
@bin/container system start $(SYSTEM_START_OPTS) && \
@bin/container system start --timeout 60 $(SYSTEM_START_OPTS) && \
echo "Starting CLI integration tests" && \
{ \
exit_code=0; \
Expand Down
10 changes: 8 additions & 2 deletions Sources/ContainerCommands/System/SystemStart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ extension Application {
help: "Specify whether the default kernel should be installed or not (default: prompt user)")
var kernelInstall: Bool?

@Option(
name: .long,
help: "Number of seconds to wait for API service to become responsive")
var timeout: Double = 10.0

@OptionGroup
public var logOptions: Flags.Logging

Expand All @@ -62,11 +67,11 @@ extension Application {

var args = [executableUrl.absolutePath()]

args.append("start")
if logOptions.debug {
args.append("--debug")
}

args.append("start")
let apiServerDataUrl = appRoot.appending(path: "apiserver")
try! FileManager.default.createDirectory(at: apiServerDataUrl, withIntermediateDirectories: true)

Expand All @@ -87,12 +92,13 @@ extension Application {
let data = try plist.encode()
try data.write(to: plistURL)

print("Registering API server with launchd...")
try ServiceManager.register(plistPath: plistURL.path)

// Now ping our friendly daemon. Fail if we don't get a response.
do {
print("Verifying apiserver is running...")
_ = try await ClientHealthCheck.ping(timeout: .seconds(10))
_ = try await ClientHealthCheck.ping(timeout: .seconds(timeout))
} catch {
throw ContainerizationError(
.internalError,
Expand Down
4 changes: 3 additions & 1 deletion Sources/Helpers/APIServer/APIServer+Start.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ extension APIServer {
}

// start up realhost DNS
/*
group.addTask {
let localhostResolver = LocalhostDNSHandler(log: log)
try localhostResolver.monitorResolvers()

let nxDomainResolver = NxDomainResolver()
let compositeResolver = CompositeResolver(handlers: [localhostResolver, nxDomainResolver])
let hostsQueryValidator = StandardQueryValidator(handler: compositeResolver)
Expand All @@ -126,6 +127,7 @@ extension APIServer {
)
try await dnsServer.run(host: Self.listenAddress, port: Self.localhostDNSPort)
}
*/
}
} catch {
log.error("\(commandName) failed", metadata: ["error": "\(error)"])
Expand Down
8 changes: 4 additions & 4 deletions Tests/CLITests/Subcommands/Networks/TestCLINetwork.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TestCLINetwork: CLITest {
}

@available(macOS 26, *)
@Test func testNetworkCreateAndUse() async throws {
@Test(.disabled()) func testNetworkCreateAndUse() async throws {
do {
let name = getLowercasedTestName()
let networkDeleteArgs = ["network", "delete", name]
Expand Down Expand Up @@ -90,7 +90,7 @@ class TestCLINetwork: CLITest {
}

@available(macOS 26, *)
@Test func testNetworkDeleteWithContainer() async throws {
@Test(.disabled()) func testNetworkDeleteWithContainer() async throws {
do {
// prep: delete container and network, ignoring if it doesn't exist
let name = getLowercasedTestName()
Expand Down Expand Up @@ -137,7 +137,7 @@ class TestCLINetwork: CLITest {
}

@available(macOS 26, *)
@Test func testNetworkLabels() async throws {
@Test(.disabled()) func testNetworkLabels() async throws {
do {
// prep: delete container and network, ignoring if it doesn't exist
let name = getLowercasedTestName()
Expand Down Expand Up @@ -193,7 +193,7 @@ class TestCLINetwork: CLITest {
}

@available(macOS 26, *)
@Test func testIsolatedNetwork() async throws {
@Test(.disabled()) func testIsolatedNetwork() async throws {
do {
let name = getLowercasedTestName()
let networkDeleteArgs = ["network", "delete", name]
Expand Down