File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
packages/functional-tests Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,24 @@ function wait() {
1212export class SmsClient {
1313 private client : RedisType ;
1414 private uidCodes : Map < string , string > ;
15+ private isConnected = false ;
16+ private hasLoggedConnectionError = false ;
1517
1618 constructor ( ) {
1719 this . client = new Redis ( ) ;
1820 this . uidCodes = new Map ( ) ;
21+
22+ this . client . on ( 'ready' , ( ) => {
23+ this . isConnected = true ;
24+ this . hasLoggedConnectionError = false ;
25+ } ) ;
26+
27+ this . client . on ( 'error' , ( err : Error ) => {
28+ if ( ! this . hasLoggedConnectionError ) {
29+ this . hasLoggedConnectionError = true ;
30+ }
31+ this . isConnected = false ;
32+ } ) ;
1933 }
2034
2135 /**
@@ -25,6 +39,10 @@ export class SmsClient {
2539 * @param timeout
2640 */
2741 async getCode ( uid : string , timeout = 10000 ) : Promise < string > {
42+ if ( ! this . isConnected ) {
43+ throw new Error ( 'Not connected to Redis' ) ;
44+ }
45+
2846 const redisKeyPattern = `recovery-phone:sms-attempt:${ uid } :*` ;
2947 const expires = Date . now ( ) + timeout ;
3048
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ import { getCode } from 'fxa-settings/src/lib/totp';
1818
1919test . describe ( 'severity-1 #smoke' , ( ) => {
2020 test . describe ( 'recovery phone' , ( ) => {
21- test . beforeEach ( async ( { pages : { configPage } } ) => {
21+ test . beforeEach ( async ( { pages : { configPage } } , { project } ) => {
2222 // Ensure that the feature flag is enabled
2323 const config = await configPage . getConfig ( ) ;
24+ test . fixme ( project . name !== 'local' , 'FXA-11159' ) ;
2425 test . skip ( config . featureFlags . enableAdding2FABackupPhone !== true ) ;
2526 test . skip ( config . featureFlags . enableUsing2FABackupPhone !== true ) ;
2627 } ) ;
You can’t perform that action at this time.
0 commit comments