Skip to content

Commit d983bcf

Browse files
committed
Fix App named app-check-not-configured has already been configured error
1 parent ecfd283 commit d983bcf

File tree

5 files changed

+11
-47
lines changed

5 files changed

+11
-47
lines changed

FirebaseVertexAI/Tests/TestApp/Sources/FirebaseAppUtils.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@
1515
import FirebaseCore
1616

1717
extension FirebaseApp {
18+
/// Configures a Firebase app with the specified name and Google Service Info plist file name.
19+
///
20+
/// - Parameters:
21+
/// - appName: The Firebase app's name; see ``FirebaseAppNames`` for app names with special
22+
/// meanings in the TestApp.
23+
/// - plistName: The file name of the Google Service Info plist, excluding the file extension;
24+
/// for the default app this is typically called `GoogleService-Info` but any file name may be
25+
/// used for other apps.
1826
static func configure(appName: String, plistName: String) {
27+
assert(!plistName.hasSuffix(".plist"), "The .plist file extension must be omitted.")
1928
guard let plistPath =
2029
Bundle.main.path(forResource: plistName, ofType: "plist") else {
2130
fatalError("The file '\(plistName).plist' was not found.")

FirebaseVertexAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct GenerateContentIntegrationTests {
185185
return false
186186
}
187187
guard case let .internalError(underlyingError) = error else {
188-
Issue.record("Expected a \(GenerateContentError.internalError.self); got \(error.self).")
188+
Issue.record("Expected a GenerateContentError.internalError(...); got \(error.self).")
189189
return false
190190
}
191191

FirebaseVertexAI/Tests/TestApp/Tests/Integration/IntegrationTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ final class IntegrationTests: XCTestCase {
229229
}
230230

231231
func testCountTokens_appCheckNotConfigured_shouldFail() async throws {
232-
let app = try FirebaseApp.defaultNamedCopy(name: FirebaseAppNames.appCheckNotConfigured)
233-
addTeardownBlock { await app.delete() }
232+
let app = try XCTUnwrap(FirebaseApp.app(name: FirebaseAppNames.appCheckNotConfigured))
234233
let vertex = VertexAI.vertexAI(app: app)
235234
let model = vertex.generativeModel(modelName: "gemini-2.0-flash")
236235
let prompt = "Why is the sky blue?"

FirebaseVertexAI/Tests/TestApp/Tests/Utilities/FirebaseAppTestUtils.swift

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

FirebaseVertexAI/Tests/TestApp/VertexAITestApp.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
8692F29A2CC9477800539E8F /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 8692F2992CC9477800539E8F /* FirebaseAuth */; };
2222
8692F29C2CC9477800539E8F /* FirebaseStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 8692F29B2CC9477800539E8F /* FirebaseStorage */; };
2323
8692F29E2CC9477800539E8F /* FirebaseVertexAI in Frameworks */ = {isa = PBXBuildFile; productRef = 8692F29D2CC9477800539E8F /* FirebaseVertexAI */; };
24-
8698D7462CD3CF3600ABA833 /* FirebaseAppTestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8698D7452CD3CF2F00ABA833 /* FirebaseAppTestUtils.swift */; };
2524
8698D7482CD4332B00ABA833 /* TestAppCheckProviderFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8698D7472CD4332B00ABA833 /* TestAppCheckProviderFactory.swift */; };
2625
86CC31352D91EE9E0087E964 /* FirebaseAppUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86CC31342D91EE9E0087E964 /* FirebaseAppUtils.swift */; };
2726
86D77DFC2D7A5340003D155D /* GenerateContentIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86D77DFB2D7A5340003D155D /* GenerateContentIntegrationTests.swift */; };
@@ -54,7 +53,6 @@
5453
868A7C502CCC263300E449DD /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
5554
868A7C532CCC26B500E449DD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5655
868A7C552CCC271300E449DD /* TestApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = TestApp.entitlements; sourceTree = "<group>"; };
57-
8698D7452CD3CF2F00ABA833 /* FirebaseAppTestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseAppTestUtils.swift; sourceTree = "<group>"; };
5856
8698D7472CD4332B00ABA833 /* TestAppCheckProviderFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestAppCheckProviderFactory.swift; sourceTree = "<group>"; };
5957
86CC31342D91EE9E0087E964 /* FirebaseAppUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseAppUtils.swift; sourceTree = "<group>"; };
6058
86D77DFB2D7A5340003D155D /* GenerateContentIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateContentIntegrationTests.swift; sourceTree = "<group>"; };
@@ -161,7 +159,6 @@
161159
isa = PBXGroup;
162160
children = (
163161
86D77E032D7B6C95003D155D /* InstanceConfig.swift */,
164-
8698D7452CD3CF2F00ABA833 /* FirebaseAppTestUtils.swift */,
165162
862218802D04E08D007ED2D4 /* IntegrationTestUtils.swift */,
166163
);
167164
path = Utilities;
@@ -292,7 +289,6 @@
292289
files = (
293290
8689CDCC2D7F8BD700BF426B /* CountTokensIntegrationTests.swift in Sources */,
294291
86D77E042D7B6C9D003D155D /* InstanceConfig.swift in Sources */,
295-
8698D7462CD3CF3600ABA833 /* FirebaseAppTestUtils.swift in Sources */,
296292
868A7C4F2CCC229F00E449DD /* Credentials.swift in Sources */,
297293
864F8F712D4980DD0002EA7E /* ImagenIntegrationTests.swift in Sources */,
298294
862218812D04E098007ED2D4 /* IntegrationTestUtils.swift in Sources */,

0 commit comments

Comments
 (0)