Skip to content

Commit d0fe059

Browse files
committed
Fix up AllTests
# Conflicts: # Tests/AppTests/AllTests.swift
1 parent 2e9a014 commit d0fe059

File tree

6 files changed

+92
-70
lines changed

6 files changed

+92
-70
lines changed

Tests/AppTests/AllTests.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
// limitations under the License.
1414

1515
import Testing
16+
import Dependencies
1617

1718

18-
@Suite struct AllTests { }
19+
@Suite(.dependency(\.date.now, .t0)) struct AllTests { }
1920

2021

2122
extension AllTests {
@@ -29,7 +30,6 @@ extension AllTests {
2930
@Suite struct API_PackageSchemaTests { }
3031
@Suite struct ApiTests { }
3132
@Suite struct AppEnvironmentTests { }
32-
@Suite struct AppTestCase { }
3333
@Suite struct AppTests { }
3434
@Suite struct ArrayExtensionTests { }
3535
@Suite struct ArrayStringExtensionTests { }
@@ -46,7 +46,6 @@ extension AllTests {
4646
@Suite struct BuildTriggerTests { }
4747
@Suite struct CustomCollectionControllerTests { }
4848
@Suite struct CustomCollectionTests { }
49-
@Suite struct DatabasePoolTests { }
5049
@Suite struct DefaultStringInterpolationTests { }
5150
@Suite struct DocUploadTests { }
5251
@Suite struct DocumentationPageProcessorTests { }
@@ -60,6 +59,7 @@ extension AllTests {
6059
@Suite struct GitTests { }
6160
@Suite struct GithubTests { }
6261
@Suite struct GitlabBuilderTests { }
62+
@Suite struct LiveGitlabBuilderTests { }
6363
@Suite struct HomeIndexModelTests { }
6464
@Suite struct IngestionTests { }
6565
@Suite struct IntExtTests { }
@@ -89,7 +89,6 @@ extension AllTests {
8989
@Suite struct PipelineTests { }
9090
@Suite struct PlausibleTests { }
9191
@Suite struct ProductTests { }
92-
@Suite struct QueryPerformanceTests { }
9392
@Suite struct QueryPlanTests { }
9493
@Suite struct RSSTests { }
9594
@Suite struct ReAnalyzeVersionsTests { }
@@ -110,16 +109,13 @@ extension AllTests {
110109
@Suite struct SignificantBuildsTests { }
111110
@Suite struct SiteURLTests { }
112111
@Suite struct SitemapTests { }
113-
@Suite struct SnapshotTestCase { }
114112
@Suite struct SocialTests { }
115113
@Suite struct StatsTests { }
116114
@Suite struct StringExtTests { }
117115
@Suite struct SwiftVersionTests { }
118116
@Suite struct TargetTests { }
119-
@Suite struct Util { }
120117
@Suite struct ValidateSPIManifestControllerTests { }
121118
@Suite struct VersionDiffTests { }
122119
@Suite struct VersionTests { }
123120
@Suite struct ViewUtilsTests { }
124-
@Suite struct WebpageSnapshotTests { }
125121
}

Tests/AppTests/GitlabBuilderTests.swift

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -154,56 +154,3 @@ extension AllTests.GitlabBuilderTests {
154154
}
155155

156156
}
157-
158-
159-
@Suite
160-
161-
162-
struct LiveGitlabBuilderTests {
163-
164-
@Test(
165-
.disabled("This is a live trigger test for end-to-end testing of pre-release builder versions")
166-
)
167-
func triggerBuild_live() async throws {
168-
try await withDependencies {
169-
// make sure environment variables are configured for live access
170-
$0.environment.awsDocsBucket = { "spi-dev-docs" }
171-
$0.environment.builderToken = {
172-
// Set this to a valid value if you want to report build results back to the server
173-
ProcessInfo.processInfo.environment["LIVE_BUILDER_TOKEN"]
174-
}
175-
$0.environment.buildTimeout = { 10 }
176-
$0.environment.gitlabPipelineToken = {
177-
// This Gitlab token is required in order to trigger the pipeline
178-
ProcessInfo.processInfo.environment["LIVE_GITLAB_PIPELINE_TOKEN"]
179-
}
180-
$0.environment.siteURL = { "https://staging.swiftpackageindex.com" }
181-
$0.httpClient = .liveValue
182-
} operation: {
183-
// set build branch to trigger on
184-
Gitlab.Builder.branch = "main"
185-
186-
let buildId = UUID()
187-
188-
// use a valid uuid from a live db if reporting back should succeed
189-
// SemanticVersion 0.3.2 on staging
190-
let versionID = UUID(uuidString: "93d8c545-15c4-43c2-946f-1b625e2596f9")!
191-
192-
// MUT
193-
let res = try await Gitlab.Builder.triggerBuild(
194-
buildId: buildId,
195-
cloneURL: "https://github.com/SwiftPackageIndex/SemanticVersion.git",
196-
isDocBuild: false,
197-
platform: .macosSpm,
198-
reference: .tag(.init(0, 3, 2)),
199-
swiftVersion: .v4,
200-
versionID: versionID
201-
)
202-
203-
print("status: \(res.status)")
204-
print("buildId: \(buildId)")
205-
print("webUrl: \(res.webUrl)")
206-
}
207-
}
208-
209-
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import Foundation
16+
17+
@testable import App
18+
19+
import Dependencies
20+
import Testing
21+
22+
23+
extension AllTests.LiveGitlabBuilderTests {
24+
25+
@Test(
26+
.disabled("This is a live trigger test for end-to-end testing of pre-release builder versions")
27+
)
28+
func triggerBuild_live() async throws {
29+
try await withDependencies {
30+
// make sure environment variables are configured for live access
31+
$0.environment.awsDocsBucket = { "spi-dev-docs" }
32+
$0.environment.builderToken = {
33+
// Set this to a valid value if you want to report build results back to the server
34+
ProcessInfo.processInfo.environment["LIVE_BUILDER_TOKEN"]
35+
}
36+
$0.environment.buildTimeout = { 10 }
37+
$0.environment.gitlabPipelineToken = {
38+
// This Gitlab token is required in order to trigger the pipeline
39+
ProcessInfo.processInfo.environment["LIVE_GITLAB_PIPELINE_TOKEN"]
40+
}
41+
$0.environment.siteURL = { "https://staging.swiftpackageindex.com" }
42+
$0.httpClient = .liveValue
43+
} operation: {
44+
// set build branch to trigger on
45+
Gitlab.Builder.branch = "main"
46+
47+
let buildId = UUID()
48+
49+
// use a valid uuid from a live db if reporting back should succeed
50+
// SemanticVersion 0.3.2 on staging
51+
let versionID = UUID(uuidString: "93d8c545-15c4-43c2-946f-1b625e2596f9")!
52+
53+
// MUT
54+
let res = try await Gitlab.Builder.triggerBuild(
55+
buildId: buildId,
56+
cloneURL: "https://github.com/SwiftPackageIndex/SemanticVersion.git",
57+
isDocBuild: false,
58+
platform: .macosSpm,
59+
reference: .tag(.init(0, 3, 2)),
60+
swiftVersion: .v4,
61+
versionID: versionID
62+
)
63+
64+
print("status: \(res.status)")
65+
print("buildId: \(buildId)")
66+
print("webUrl: \(res.webUrl)")
67+
}
68+
}
69+
70+
}

Tests/AppTests/MaintainerInfoIndexModelTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import SnapshotTesting
2020
import Testing
2121

2222

23-
@Suite(.dependency(\.date.now, .t0))
24-
struct MaintainerInfoIndexModelTests {
23+
extension AllTests.MaintainerInfoIndexModelTests {
2524

2625
@Test func badgeURL() throws {
2726
withDependencies {

Tests/AppTests/QueryPerformanceTests.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ import Testing
2020
import Vapor
2121

2222

23-
@Suite(
24-
.serialized,
25-
.tags(.performance),
26-
.disabled(if: !runQueryPerformanceTests())
27-
)
28-
struct QueryPerformanceTests {
23+
extension AllTests {
24+
@Suite(
25+
.serialized,
26+
.tags(.performance),
27+
.disabled(if: !runQueryPerformanceTests())
28+
)
29+
struct QueryPerformanceTests { }
30+
}
31+
32+
33+
extension AllTests.QueryPerformanceTests {
2934
// Set this to true when running locally to convert warnings to test failures for easier updating of values.
3035
static let failOnWarning = false
3136

@@ -220,7 +225,7 @@ extension SQLQueryBuilder {
220225
}
221226

222227

223-
private extension QueryPerformanceTests {
228+
private extension AllTests.QueryPerformanceTests {
224229

225230
func assertQueryPerformance(_ query: SQLQueryBuilder,
226231
expectedCost: Double,

Tests/AppTests/WebpageSnapshotTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ private extension DependenciesProvider {
3636
}
3737

3838

39-
@Suite(.dependencies(.default)) struct WebpageSnapshotTests {
39+
extension AllTests {
40+
@Suite(.dependencies(.default)) struct WebpageSnapshotTests { }
41+
}
42+
43+
44+
extension AllTests.WebpageSnapshotTests {
4045

4146
@Test func HomeIndex_document() throws {
4247
Supporters.mock()

0 commit comments

Comments
 (0)