Skip to content

Commit e27866d

Browse files
authored
Remove long disabled integration test (#1034)
* Remove long disabled integration test There's no reasonable expectation for reenabling this test because the attributes that make it unsuitable for running in CI won't change * Remove additional file only used in removed test
1 parent fcd6e2d commit e27866d

File tree

4 files changed

+0
-545
lines changed

4 files changed

+0
-545
lines changed

Tests/SwiftDocCUtilitiesTests/PreviewActionIntegrationTests.swift

Lines changed: 0 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ import XCTest
1515
import SwiftDocCTestUtilities
1616

1717
class PreviewActionIntegrationTests: XCTestCase {
18-
func json(contentsOf url: URL) throws -> [String: Any] {
19-
let data = try Data(contentsOf: url)
20-
guard let result = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
21-
XCTFail("Failed to load JSON from \(url.path)")
22-
return [:]
23-
}
24-
return result
25-
}
26-
2718
private func createMinimalDocsBundle() -> Folder {
2819
let overviewURL = Bundle.module.url(
2920
forResource: "Overview", withExtension: "tutorial", subdirectory: "Test Resources")!
@@ -72,156 +63,6 @@ class PreviewActionIntegrationTests: XCTestCase {
7263
return (sourceURL: sourceURL, outputURL: outputURL, templateURL: templateURL)
7364
}
7465

75-
/// Test the fix for <rdar://problem/48615392>.
76-
func testWatchRecoversAfterConversionErrors() throws {
77-
#if os(macOS)
78-
throw XCTSkip("This test is flaky rdar://90866510")
79-
80-
// // Source files.
81-
// let source = createMinimalDocsBundle()
82-
// let (sourceURL, outputURL, templateURL) = try createPreviewSetup(source: source)
83-
//
84-
// let logStorage = LogHandle.LogStorage()
85-
// var logHandle = LogHandle.memory(logStorage)
86-
//
87-
// let convertActionTempDirectory = try createTemporaryDirectory()
88-
// let createConvertAction = {
89-
// try ConvertAction(
90-
// documentationBundleURL: sourceURL,
91-
// outOfProcessResolver: nil,
92-
// analyze: false,
93-
// targetDirectory: outputURL,
94-
// htmlTemplateDirectory: templateURL,
95-
// emitDigest: false,
96-
// currentPlatforms: nil,
97-
// fileManager: FileManager.default,
98-
// temporaryDirectory: convertActionTempDirectory)
99-
// }
100-
//
101-
// guard let preview = try? PreviewAction(
102-
// tlsCertificateKey: nil,
103-
// tlsCertificateChain: nil,
104-
// serverUsername: nil,
105-
// serverPassword: nil,
106-
// port: 8080, // We ignore this value when we set the `bindServerToSocketPath` property below.
107-
// createConvertAction: createConvertAction) else {
108-
// XCTFail("Could not create preview action from parameters")
109-
// return
110-
// }
111-
//
112-
// let socketURL = try createTemporaryDirectory().appendingPathComponent("sock")
113-
// preview.bindServerToSocketPath = socketURL.path
114-
//
115-
// // The technology output file URL
116-
// let convertedOverviewURL = outputURL
117-
// .appendingPathComponent("data")
118-
// .appendingPathComponent("tutorials")
119-
// .appendingPathComponent("Overview.json")
120-
//
121-
// // Start watching the source and get the initial (successful) state.
122-
// do {
123-
// let logOutputExpectation = asyncLogExpectation(log: logStorage, description: "Did produce log output") { $0.contains("=======") }
124-
//
125-
// // Start the preview and keep it running for the asserts that follow inside this test.
126-
// DispatchQueue.global().async {
127-
// var action = preview as Action
128-
// do {
129-
// let result = try action.perform(logHandle: logHandle)
130-
//
131-
// guard !result.problems.containsErrors else {
132-
// throw ErrorsEncountered()
133-
// }
134-
//
135-
// if !result.problems.isEmpty {
136-
// print(result.problems.localizedDescription, to: &logHandle)
137-
// }
138-
// } catch {
139-
// XCTFail(error.localizedDescription)
140-
// }
141-
// }
142-
//
143-
// wait(for: [logOutputExpectation], timeout: 20.0)
144-
//
145-
// // Check the log output to confirm that expected informational
146-
// // text is printed
147-
// let logOutput = logStorage.text
148-
//
149-
// // rdar://71318888
150-
// let expectedLogIntroductoryOutput = """
151-
// Input: \(sourceURL.path)
152-
// Template: \(templateURL.path)
153-
// """
154-
// XCTAssertTrue(logOutput.hasPrefix(expectedLogIntroductoryOutput), """
155-
// Missing expected input and template information in log/print output
156-
// """)
157-
//
158-
// if let previewInfoStart = logOutput.range(of: "=====\n")?.upperBound,
159-
// let previewInfoEnd = logOutput[previewInfoStart...].range(of: "\n=====")?.lowerBound {
160-
// XCTAssertEqual(logOutput[previewInfoStart..<previewInfoEnd], """
161-
// Starting Local Preview Server
162-
// \t Address: http://localhost:8080/documentation/mykit
163-
// \t http://localhost:8080/tutorials/overview
164-
// """)
165-
// } else {
166-
// XCTFail("Missing preview information in log/print output")
167-
// }
168-
//
169-
// XCTAssertTrue(FileManager.default.fileExists(atPath: convertedOverviewURL.path, isDirectory: nil))
170-
// }
171-
//
172-
// // Verify conversion result.
173-
// let json1 = try json(contentsOf: convertedOverviewURL)
174-
// guard let sections = json1["sections"] as? [[String: Any]],
175-
// let intro = sections.first( where: { $0["kind"] as? String == "hero" }),
176-
// let initialIntroTitle = intro["title"] as? String else {
177-
// XCTFail("Couldn't parse converted markdown")
178-
// return
179-
// }
180-
//
181-
// XCTAssertEqual(initialIntroTitle, "Technology X")
182-
//
183-
// let invalidJSONSymbolGraphURL = sourceURL.appendingPathComponent("invalid-incomplete-data.symbols.json")
184-
//
185-
// // Start watching the source and detect failed conversion.
186-
// do {
187-
// let outputExpectation = asyncLogExpectation(log: logStorage, description: "Did produce output") { $0.contains("Compilation failed") }
188-
//
189-
// // this is invalid JSON and will result in an error
190-
// try "{".write(to: invalidJSONSymbolGraphURL, atomically: true, encoding: .utf8)
191-
//
192-
// // Wait for watch to produce output.
193-
// wait(for: [outputExpectation], timeout: 20.0)
194-
// }
195-
//
196-
// // Start watching the source and detect recovery and successful conversion after a failure.
197-
// do {
198-
// let outputExpectation = asyncLogExpectation(log: logStorage, description: "Did finish conversion") { $0.contains("Done") }
199-
//
200-
// try FileManager.default.removeItem(at: invalidJSONSymbolGraphURL)
201-
//
202-
// // Wait for watch to produce output.
203-
// wait(for: [outputExpectation], timeout: 20.0)
204-
//
205-
// // Check conversion result.
206-
// let finalJSON = try json(contentsOf: convertedOverviewURL)
207-
// guard let sections = finalJSON["sections"] as? [[String: Any]],
208-
// let intro = sections.first( where: { $0["kind"] as? String == "hero" }),
209-
// let finalIntroTitle = intro["title"] as? String else {
210-
// XCTFail("Couldn't parse converted markdown")
211-
// return
212-
// }
213-
// XCTAssertEqual(finalIntroTitle, "Technology X")
214-
// }
215-
//
216-
// // Make sure to stop the preview process so it doesn't stay alive on the machine running the tests.
217-
// try preview.stop()
218-
//
219-
// try FileManager.default.removeItem(at: sourceURL)
220-
// try FileManager.default.removeItem(at: outputURL)
221-
// try FileManager.default.removeItem(at: templateURL)
222-
#endif
223-
}
224-
22566
func testThrowsHumanFriendlyErrorWhenCannotStartServerOnAGivenPort() async throws {
22667
// Binding an invalid address
22768
try await assert(bindPort: -1, expectedErrorMessage: "Can't start the preview server on port -1")

Tests/SwiftDocCUtilitiesTests/PreviewServer/HTTPClient.swift

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)