Skip to content

test(ai): add integration tests #8853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jun 5, 2025
Merged

test(ai): add integration tests #8853

merged 30 commits into from
Jun 5, 2025

Conversation

dlarocque
Copy link
Contributor

@dlarocque dlarocque commented Mar 19, 2025

Adds initial setup for integration tests, and integration tests for count tokens, generate content, and chat. Each test runs against both backends (Vertex AI and Google AI), for each specified model in the config.

These tests aim to catch issues that are caused by changes in the backend (e.g. A required field suddenly no longer being sent), and to allow us to confidently support new models by just adding them to the set of models we test against.

Future PRs will integrate this into our CI.

Sample output:

  Chat Session
    Google AI gemini-2.0-flash
      ✔ startChat and sendMessage: text input, text output
    Vertex AI gemini-2.0-flash
      ✔ startChat and sendMessage: text input, text output
  Count Tokens
    Google AI gemini-2.0-flash
      ✔ text input
      ✔ image input
      ✔ audio input
      ✔ text, image, and audio input
      ✔ public storage reference
    Vertex AI gemini-2.0-flash
      ✔ text input
      ✔ image input
      ✔ audio input
      ✔ text, image, and audio input
      ✔ public storage reference
  Generate Content
    Google AI gemini-2.0-flash
      ✔ generateContent: text input, text output
      ✔ generateContentStream: text input, text output
    Vertex AI gemini-2.0-flash
      ✔ generateContent: text input, text output
      ✔ generateContentStream: text input, text output

@dlarocque dlarocque requested a review from a team as a code owner March 19, 2025 19:57
Copy link

changeset-bot bot commented Mar 19, 2025

⚠️ No Changeset found

Latest commit: 63f7215

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 19, 2025

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (770e455)Merge (572f535)Diff
    browser385 kB385 kB+151 B (+0.0%)
    module385 kB385 kB+151 B (+0.0%)
    react-native385 kB386 kB+151 B (+0.0%)
  • bundle

    TypeBase (770e455)Merge (572f535)Diff
    firestore (CSI Auto Indexing Disable and Delete)279 kB280 kB+151 B (+0.1%)
    firestore (CSI Auto Indexing Enable)279 kB280 kB+151 B (+0.1%)
    firestore (Persistence)311 kB311 kB+151 B (+0.0%)
    firestore (Query Cursors)256 kB256 kB+151 B (+0.1%)
    firestore (Query)254 kB254 kB+151 B (+0.1%)
    firestore (Read data once)242 kB242 kB+151 B (+0.1%)
    firestore (Read Write w Persistence)335 kB336 kB+151 B (+0.0%)
    firestore (Realtime updates)244 kB244 kB+151 B (+0.1%)
    firestore (Transaction)221 kB221 kB+151 B (+0.1%)
    firestore (Write data)220 kB220 kB+151 B (+0.1%)
  • firebase

    TypeBase (770e455)Merge (572f535)Diff
    firebase-compat.js802 kB802 kB+149 B (+0.0%)
    firebase-firestore-compat.js347 kB347 kB+149 B (+0.0%)
    firebase-firestore.js449 kB449 kB+151 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/eQugwWJ3mB.html

@@ -39,6 +39,7 @@
"test:ci": "yarn testsetup && node ../../scripts/run_tests_in_ci.js -s test",
"test:skip-clone": "karma start",
"test:browser": "yarn testsetup && karma start",
"test:integration": "karma start --integration",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to call this from "test" (line 38) if you want to run it on PRs or do you not want to do that yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to add this to test since then it'll be ran when someone runs test in the root directory- which is going to fail if someone hasn't defined the config that's used in these tests. Could be annoying for people working on other SDKs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 19, 2025

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • addDoc

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size134 kB135 kB+151 B (+0.1%)
      size-with-ext-deps206 kB207 kB+151 B (+0.1%)
    • deleteDoc

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size125 kB125 kB+151 B (+0.1%)
      size-with-ext-deps197 kB197 kB+151 B (+0.1%)
    • disableNetwork

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size113 kB113 kB+151 B (+0.1%)
      size-with-ext-deps185 kB185 kB+151 B (+0.1%)
    • enableIndexedDbPersistence

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size189 kB189 kB+151 B (+0.1%)
      size-with-ext-deps261 kB262 kB+151 B (+0.1%)
    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size225 kB226 kB+151 B (+0.1%)
      size-with-ext-deps298 kB298 kB+151 B (+0.1%)
    • enableNetwork

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size113 kB113 kB+151 B (+0.1%)
      size-with-ext-deps185 kB185 kB+151 B (+0.1%)
    • executeWrite

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size124 kB124 kB+151 B (+0.1%)
      size-with-ext-deps196 kB196 kB+151 B (+0.1%)
    • getAggregateFromServer

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size121 kB121 kB+151 B (+0.1%)
      size-with-ext-deps193 kB193 kB+151 B (+0.1%)
    • getCountFromServer

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size121 kB121 kB+151 B (+0.1%)
      size-with-ext-deps193 kB193 kB+151 B (+0.1%)
    • getDoc

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size155 kB156 kB+151 B (+0.1%)
      size-with-ext-deps227 kB228 kB+151 B (+0.1%)
    • getDocFromServer

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size156 kB156 kB+151 B (+0.1%)
      size-with-ext-deps227 kB228 kB+151 B (+0.1%)
    • getDocs

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size157 kB157 kB+151 B (+0.1%)
      size-with-ext-deps229 kB229 kB+151 B (+0.1%)
    • getDocsFromServer

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size157 kB157 kB+151 B (+0.1%)
      size-with-ext-deps229 kB229 kB+151 B (+0.1%)
    • loadBundle

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size123 kB123 kB+151 B (+0.1%)
      size-with-ext-deps195 kB195 kB+151 B (+0.1%)
    • memoryLocalCache

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size107 kB107 kB+151 B (+0.1%)
      size-with-ext-deps179 kB179 kB+151 B (+0.1%)
    • onSnapshot

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size158 kB158 kB+151 B (+0.1%)
      size-with-ext-deps230 kB230 kB+151 B (+0.1%)
    • onSnapshotsInSync

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size146 kB147 kB+151 B (+0.1%)
      size-with-ext-deps218 kB219 kB+151 B (+0.1%)
    • persistentLocalCache

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size185 kB185 kB+151 B (+0.1%)
      size-with-ext-deps257 kB258 kB+151 B (+0.1%)
    • persistentMultipleTabManager

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size221 kB221 kB+151 B (+0.1%)
      size-with-ext-deps293 kB293 kB+151 B (+0.1%)
    • persistentSingleTabManager

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size185 kB185 kB+151 B (+0.1%)
      size-with-ext-deps257 kB257 kB+151 B (+0.1%)
    • runTransaction

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size135 kB135 kB+151 B (+0.1%)
      size-with-ext-deps207 kB207 kB+151 B (+0.1%)
    • setDoc

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size134 kB134 kB+151 B (+0.1%)
      size-with-ext-deps206 kB206 kB+151 B (+0.1%)
    • updateDoc

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size134 kB134 kB+151 B (+0.1%)
      size-with-ext-deps206 kB206 kB+151 B (+0.1%)
    • waitForPendingWrites

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size114 kB114 kB+151 B (+0.1%)
      size-with-ext-deps186 kB186 kB+151 B (+0.1%)
    • writeBatch

      Size

      TypeBase (770e455)Merge (572f535)Diff
      size136 kB136 kB+151 B (+0.1%)
      size-with-ext-deps208 kB208 kB+151 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/6GTZZWxcMS.html

@dlarocque dlarocque requested a review from hsubox76 March 20, 2025 16:07
@dlarocque dlarocque force-pushed the dl/vertex-integration branch from 346de4e to 7ad7833 Compare March 21, 2025 20:07
@dlarocque dlarocque changed the title Vertex AI Integration Tests test: add VertexAI integration tests Mar 28, 2025
Copy link
Contributor

Vertex AI Mock Responses Check ⚠️

A newer major version of the mock responses for Vertex AI unit tests is available. update_vertexai_responses.sh should be updated to clone the latest version of the responses: v13.0

@dlarocque dlarocque changed the title test: add VertexAI integration tests test(ai): add integration tests May 22, 2025
@dlarocque dlarocque merged commit d590889 into main Jun 5, 2025
38 checks passed
@dlarocque dlarocque deleted the dl/vertex-integration branch June 5, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants