Procházet zdrojové kódy

Test environment variable access

Andrew Heard před 1 rokem
rodič
revize
fc649441bb

+ 1 - 0
.github/workflows/vertexai.yml

@@ -51,6 +51,7 @@ jobs:
     runs-on: ${{ matrix.os }}
     env:
       FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
+      FOO_VARIABLE: foo
       plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
     steps:
     - uses: actions/checkout@v4

+ 22 - 17
FirebaseVertexAI/Tests/Integration/IntegrationTests.swift

@@ -53,25 +53,30 @@ import XCTest
 
     // MARK: - Generate Content
 
-    func testGenerateContent() async throws {
-      let prompt = "Where is Google headquarters located? Answer with the city name only."
-
-      let response = try await model.generateContent(prompt)
-
-      let text = try XCTUnwrap(response.text).trimmingCharacters(in: .whitespacesAndNewlines)
-      XCTAssertEqual(text, "Mountain View")
+    func testEnvironmentVariable() throws {
+      let token = try XCTUnwrap(ProcessInfo.processInfo.environment["FOO_VARIABLE"])
+      XCTAssertEqual(token, "foo")
     }
 
-    // MARK: - Count Tokens
-
-    func testCountTokens() async throws {
-      let prompt = "Why is the sky blue?"
-
-      let response = try await model.countTokens(prompt)
-
-      XCTAssertEqual(response.totalTokens, 6)
-      XCTAssertEqual(response.totalBillableCharacters, 16)
-    }
+//    func testGenerateContent() async throws {
+//      let prompt = "Where is Google headquarters located? Answer with the city name only."
+//
+//      let response = try await model.generateContent(prompt)
+//
+//      let text = try XCTUnwrap(response.text).trimmingCharacters(in: .whitespacesAndNewlines)
+//      XCTAssertEqual(text, "Mountain View")
+//    }
+//
+//    // MARK: - Count Tokens
+//
+//    func testCountTokens() async throws {
+//      let prompt = "Why is the sky blue?"
+//
+//      let response = try await model.countTokens(prompt)
+//
+//      XCTAssertEqual(response.totalTokens, 6)
+//      XCTAssertEqual(response.totalBillableCharacters, 16)
+//    }
   }
 
 #endif // os(macOS)