Skip to content

Commit

Permalink
Disable Async Tests for macOS CI (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler authored Nov 26, 2021
1 parent 5ea7ebc commit bf82d9a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tests/HummingbirdFoundationTests/FileTests+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class HummingbirdAsyncFilesTests: XCTestCase {
}

func testRead() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = HBApplication(testing: .live)
app.router.get("test.jpg") { request -> HBResponse in
let fileIO = HBFileIO(application: request.application)
Expand All @@ -50,6 +54,10 @@ class HummingbirdAsyncFilesTests: XCTestCase {
}

func testWrite() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let filename = "testWrite.txt"
let app = HBApplication(testing: .live)
app.router.put("store") { request -> HTTPResponseStatus in
Expand Down
4 changes: 4 additions & 0 deletions Tests/HummingbirdJobsTests/HummingbirdJobsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ final class HummingbirdJobsTests: XCTestCase {

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
func testAsyncJob() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
struct TestAsyncJob: HBAsyncJob {
static let name = "testAsyncJob"
static let expectation = XCTestExpectation(description: "Jobs Completed")
Expand Down
16 changes: 16 additions & 0 deletions Tests/HummingbirdTests/AsyncAwaitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ final class AsyncAwaitTests: XCTestCase {
}

func testAsyncRoute() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = HBApplication(testing: .live)
app.router.get("/hello") { request -> ByteBuffer in
return await self.getBuffer(request: request)
Expand All @@ -48,6 +52,10 @@ final class AsyncAwaitTests: XCTestCase {
}

func testAsyncMiddleware() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
struct AsyncTestMiddleware: HBAsyncMiddleware {
func apply(to request: HBRequest, next: HBResponder) async throws -> HBResponse {
var response = try await next.respond(to: request)
Expand All @@ -69,6 +77,10 @@ final class AsyncAwaitTests: XCTestCase {
}

func testAsyncRouteHandler() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
struct AsyncTest: HBAsyncRouteHandler {
let name: String
init(from request: HBRequest) throws {
Expand All @@ -93,6 +105,10 @@ final class AsyncAwaitTests: XCTestCase {

/// Test streaming of requests via AsyncSequence
func testStreaming() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = HBApplication(testing: .live)
app.router.post("size", options: .streamBody) { request -> String in
guard let stream = request.body.stream else {
Expand Down
32 changes: 32 additions & 0 deletions Tests/HummingbirdTests/PersistTests+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testSetGet() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
try app.XCTStart()
defer { app.XCTStop() }
Expand All @@ -62,6 +66,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testCreateGet() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
app.router.put("/create/:tag") { request -> HTTPResponseStatus in
guard let buffer = request.body.buffer else { throw HBHTTPError(.badRequest) }
Expand All @@ -80,6 +88,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testDoubleCreateFail() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
app.router.put("/create/:tag") { request -> HTTPResponseStatus in
guard let buffer = request.body.buffer else { throw HBHTTPError(.badRequest) }
Expand All @@ -103,6 +115,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testSetTwice() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
try app.XCTStart()
defer { app.XCTStop() }
Expand All @@ -119,6 +135,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testExpires() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
try app.XCTStart()
defer { app.XCTStop() }
Expand All @@ -139,6 +159,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testCodable() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
struct TestCodable: Codable {
let buffer: String
}
Expand Down Expand Up @@ -166,6 +190,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testRemove() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
try app.XCTStart()
defer { app.XCTStop() }
Expand All @@ -179,6 +207,10 @@ final class AsyncPersistTests: XCTestCase {
}

func testExpireAndAdd() throws {
#if os(macOS)
// disable macOS tests in CI. GH Actions are currently running this when they shouldn't
guard HBEnvironment().get("CI") != "true" else { throw XCTSkip() }
#endif
let app = try createApplication()
try app.XCTStart()
defer { app.XCTStop() }
Expand Down

0 comments on commit bf82d9a

Please sign in to comment.