From e837b642990c67080963623aa35febbd86c3ae08 Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Mon, 2 May 2022 10:39:54 -0700 Subject: [PATCH] fix: flaky system test (#882) --- system-test/speech_system_test.js | 4 ++-- system-test/speech_system_test_v1.js | 4 ++-- system-test/speech_system_test_v1p1beta1.js | 4 ++-- system-test/speech_typescript_system_test.ts | 6 +++--- system-test/speech_typescript_system_test_v1.ts | 6 +++--- system-test/speech_typescript_system_test_v1p1beta1.ts | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/system-test/speech_system_test.js b/system-test/speech_system_test.js index 4b980829..97baa848 100644 --- a/system-test/speech_system_test.js +++ b/system-test/speech_system_test.js @@ -95,9 +95,9 @@ describe('SpeechClient system test default', () => { const stream = client.streamingRecognize(request); let gotResponse = false; stream.on('data', response => { - assert.strictEqual( + assert.match( response.results[0].alternatives[0].transcript, - 'test of streaming recognized call' + /test of streaming.*call/ ); gotResponse = true; }); diff --git a/system-test/speech_system_test_v1.js b/system-test/speech_system_test_v1.js index ba5c207a..778a08bf 100644 --- a/system-test/speech_system_test_v1.js +++ b/system-test/speech_system_test_v1.js @@ -95,9 +95,9 @@ describe('SpeechClient system test v1', () => { const stream = client.streamingRecognize(request); let gotResponse = false; stream.on('data', response => { - assert.strictEqual( + assert.match( response.results[0].alternatives[0].transcript, - 'test of streaming recognized call' + /test of streaming.*call/ ); gotResponse = true; }); diff --git a/system-test/speech_system_test_v1p1beta1.js b/system-test/speech_system_test_v1p1beta1.js index 8f5826cf..c1fd231a 100644 --- a/system-test/speech_system_test_v1p1beta1.js +++ b/system-test/speech_system_test_v1p1beta1.js @@ -95,9 +95,9 @@ describe('SpeechClient system test v1p1beta1', () => { const stream = client.streamingRecognize(request); let gotResponse = false; stream.on('data', response => { - assert.strictEqual( + assert.match( response.results[0].alternatives[0].transcript, - 'test of streaming recognized call' + /test of streaming.*call/ ); gotResponse = true; }); diff --git a/system-test/speech_typescript_system_test.ts b/system-test/speech_typescript_system_test.ts index a5674d9e..6d701c78 100644 --- a/system-test/speech_typescript_system_test.ts +++ b/system-test/speech_typescript_system_test.ts @@ -107,9 +107,9 @@ describe('SpeechClient TypeScript system test default', () => { stream.on( 'data', (response: google.cloud.speech.v1.IStreamingRecognizeResponse) => { - assert.strictEqual( - response.results![0].alternatives![0].transcript, - 'test of streaming recognized call' + assert.match( + response.results![0].alternatives![0].transcript ?? '', + /test of streaming.*call/ ); gotResponse = true; } diff --git a/system-test/speech_typescript_system_test_v1.ts b/system-test/speech_typescript_system_test_v1.ts index 2227be85..d3f63e8c 100644 --- a/system-test/speech_typescript_system_test_v1.ts +++ b/system-test/speech_typescript_system_test_v1.ts @@ -107,9 +107,9 @@ describe('SpeechClient TypeScript system test v1', () => { stream.on( 'data', (response: google.cloud.speech.v1.IStreamingRecognizeResponse) => { - assert.strictEqual( - response.results![0].alternatives![0].transcript, - 'test of streaming recognized call' + assert.match( + response.results![0].alternatives![0].transcript ?? '', + /test of streaming.*call/ ); gotResponse = true; } diff --git a/system-test/speech_typescript_system_test_v1p1beta1.ts b/system-test/speech_typescript_system_test_v1p1beta1.ts index 280b2e82..31ef1868 100644 --- a/system-test/speech_typescript_system_test_v1p1beta1.ts +++ b/system-test/speech_typescript_system_test_v1p1beta1.ts @@ -107,9 +107,9 @@ describe('SpeechClient TypeScript system test v1p1beta1', () => { stream.on( 'data', (response: google.cloud.speech.v1p1beta1.IStreamingRecognizeResponse) => { - assert.strictEqual( - response.results![0].alternatives![0].transcript, - 'test of streaming recognized call' + assert.match( + response.results![0].alternatives![0].transcript ?? '', + /test of streaming.*call/ ); gotResponse = true; }