Skip to content

Commit

Permalink
test: Fix data deletion e2e tests
Browse files Browse the repository at this point in the history
The "Delete MetaMetrics Data" e2e tests were recently broken due to a
change in CI configuration. The code-under-test was written to always
use the environment variable present for the data deletion source ID
and endpoint, but the e2e tests wrongly assumed that it would never be
present.

The service has been updated to use the fallback values for e2e test
builds, even if the environment variable is present.
  • Loading branch information
Gudahtt committed Oct 31, 2024
1 parent 956f99a commit 2755584
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/scripts/services/data-deletion-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ import {
import getFetchWithTimeout from '../../../shared/modules/fetch-with-timeout';
import { DeleteRegulationStatus } from '../../../shared/constants/metametrics';

const DEFAULT_ANALYTICS_DATA_DELETION_SOURCE_ID =
process.env.ANALYTICS_DATA_DELETION_SOURCE_ID ?? 'test';
const DEFAULT_ANALYTICS_DATA_DELETION_ENDPOINT =
process.env.ANALYTICS_DATA_DELETION_ENDPOINT ??
'https://metametrics.metamask.test';
const inTest = process.env.IN_TEST;
const fallbackSourceId = 'test';
const fallbackDataDeletionEndpoint = 'https://metametrics.metamask.test';

const DEFAULT_ANALYTICS_DATA_DELETION_SOURCE_ID = inTest
? fallbackSourceId
: process.env.ANALYTICS_DATA_DELETION_SOURCE_ID ?? fallbackSourceId;
const DEFAULT_ANALYTICS_DATA_DELETION_ENDPOINT = inTest
? fallbackDataDeletionEndpoint
: process.env.ANALYTICS_DATA_DELETION_ENDPOINT ??
fallbackDataDeletionEndpoint;

/**
* The number of times we retry a specific failed request to the data deletion API.
Expand Down

0 comments on commit 2755584

Please sign in to comment.