Skip to content

Commit 3a54a7d

Browse files
committed
fix tests running against linux by just grabbing spec files to test against and storing them in-repo
1 parent c72fad4 commit 3a54a7d

12 files changed

Lines changed: 69068 additions & 16 deletions

Tests/OpenAPIKit30RealSpecSuite/GitHubAPITests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,18 @@ final class GitHubAPICampatibilityTests: XCTestCase {
2727
commit for now.
2828
*/
2929
if githubAPI == nil {
30+
// Test file can be redownloaded from
31+
// https://raw.githubusercontent.com/github/rest-api-description/e4f28959fbc6c9fc4eea823b495061dded87e84d/descriptions/ghes-3.0/ghes-3.0.yaml
3032
githubAPI = Result {
3133
try YAMLDecoder().decode(
3234
OpenAPI.Document.self,
33-
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/github/rest-api-description/e4f28959fbc6c9fc4eea823b495061dded87e84d/descriptions/ghes-3.0/ghes-3.0.yaml")!)
35+
from: String(contentsOf: URL(filePath: "../inputs/ghes-3.0.yaml"), encoding: .utf8)
3436
)
3537
}
3638
}
3739
}
3840

3941
func test_successfullyParsedDocument() throws {
40-
#if os(Linux)
41-
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
42-
#endif
4342
switch githubAPI {
4443
case nil:
4544
XCTFail("Did not attempt to pull GitHub API documentation like expected.")

Tests/OpenAPIKit30RealSpecSuite/GoogleBooksAPITests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ final class GoogleBooksAPICampatibilityTests: XCTestCase {
2222

2323
override func setUp() {
2424
if booksAPI == nil {
25+
// Test file can be redownloaded from
26+
// https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/googleapis.com/books/v1/openapi.yaml
2527
booksAPI = Result {
2628
try YAMLDecoder().decode(
2729
OpenAPI.Document.self,
28-
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/googleapis.com/books/v1/openapi.yaml")!)
30+
from: String(contentsOf: URL(filePath: "../inputs/google-books-3.0.yaml"), encoding: .utf8)
2931
)
3032
}
3133
}
3234
}
3335

3436
func test_successfullyParsedDocument() throws {
35-
#if os(Linux)
36-
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
37-
#endif
3837
switch booksAPI {
3938
case nil:
4039
XCTFail("Did not attempt to pull Google Books API documentation like expected.")

Tests/OpenAPIKit30RealSpecSuite/PetStoreAPITests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ final class PetStoreAPICampatibilityTests: XCTestCase {
2222

2323
override func setUp() {
2424
if petStoreAPI == nil {
25+
// Test file can be redownloaded from
26+
// https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml
2527
petStoreAPI = Result {
2628
try YAMLDecoder().decode(
2729
OpenAPI.Document.self,
28-
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml")!)
30+
from: String(contentsOf: URL(filePath: "../inputs/pet-store-3.0.yaml"), encoding: .utf8)
2931
)
3032
}
3133
}
3234
}
3335

3436
func test_successfullyParsedDocument() throws {
35-
#if os(Linux)
36-
throw XCTSkip("Swift bug causes CI failure currently (line 48): failed - The operation could not be completed. The file doesn’t exist.")
37-
#endif
3837
switch petStoreAPI {
3938
case nil:
4039
XCTFail("Did not attempt to pull Pet Store API documentation like expected.")

Tests/OpenAPIKit30RealSpecSuite/TomTomAPITests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ final class TomTomAPICampatibilityTests: XCTestCase {
2222

2323
override func setUp() {
2424
if tomtomAPI == nil {
25+
// Test file can be redownloaded from
26+
// https://raw.githubusercontent.com/APIs-guru/openapi-directory/c9190db19e5cb151592d44f0d4482839e1e5a8e0/APIs/tomtom.com/search/1.0.0/openapi.yaml
2527
tomtomAPI = Result {
2628
try YAMLDecoder().decode(
2729
OpenAPI.Document.self,
28-
from: String(contentsOf: URL(string: "https://raw.githubusercontent.com/APIs-guru/openapi-directory/c9190db19e5cb151592d44f0d4482839e1e5a8e0/APIs/tomtom.com/search/1.0.0/openapi.yaml")!)
30+
from: String(contentsOf: URL(filePath: "../inputs/tomtom-3.0.yaml"), encoding: .utf8)
2931
)
3032
}
3133
}
3234
}
3335

3436
func test_successfullyParsedDocument() throws {
35-
#if os(Linux)
36-
throw XCTSkip("Swift bug causes CI failure currently (line 43): failed - The operation could not be completed. The file doesn’t exist.")
37-
#endif
3837
switch tomtomAPI {
3938
case nil:
4039
XCTFail("Did not attempt to pull TomTom API documentation like expected.")

Tests/inputs/ghes-3.0-LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 GitHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)