Skip to content

Commit

Permalink
Disable telemetry in health checks (#2309)
Browse files Browse the repository at this point in the history
* disable telemetry in health checks

* handle in tests

* handle in tests
  • Loading branch information
sobolk authored Dec 9, 2024
1 parent 1d035b8 commit 1a2521a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changeset/loud-dots-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 5 additions & 0 deletions .github/workflows/health_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
- cron: '0 0,6,12,18 * * *'
workflow_dispatch:

env:
# Health checks can run on un-released code. Often work in progress.
# Disable data from there.
AMPLIFY_DISABLE_TELEMETRY: true

jobs:
install:
strategy:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'node:assert';
import { beforeEach, describe, it, mock } from 'node:test';
import { after, before, beforeEach, describe, it, mock } from 'node:test';

import { UsageDataEmitterFactory } from './usage_data_emitter_factory';
import { DefaultUsageDataEmitter } from './usage_data_emitter';
Expand All @@ -21,6 +21,19 @@ void describe('UsageDataEmitterFactory', () => {
() => mockedConfigController
);

const originalAmplifyDisableTelemetry =
process.env['AMPLIFY_DISABLE_TELEMETRY'];

before(() => {
// Unset AMPLIFY_DISABLE_TELEMETRY. We may be setting this variable in GitHub workflows.
delete process.env['AMPLIFY_DISABLE_TELEMETRY'];
});

after(() => {
// Restore original value after tests.
process.env['AMPLIFY_DISABLE_TELEMETRY'] = originalAmplifyDisableTelemetry;
});

beforeEach(() => {
configControllerGet.mock.resetCalls();
});
Expand Down

0 comments on commit 1a2521a

Please sign in to comment.