diff --git a/src/lib/constants.ts b/src/lib/constants.ts index efebe689..7c1322cc 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -27,9 +27,7 @@ const constants = { hostOSVersionPath: checkString(process.env.HOST_OS_VERSION_PATH) || `${rootMountPoint}/etc/os-release`, - macAddressPath: - checkString(process.env.MAC_ADDRESS_PATH) || - `${rootMountPoint}/sys/class/net`, + macAddressPath: checkString(process.env.MAC_ADDRESS_PATH) || `/sys/class/net`, privateAppEnvVars: [ 'RESIN_SUPERVISOR_API_KEY', 'RESIN_API_KEY', diff --git a/test/integration/config.spec.ts b/test/integration/config.spec.ts index d7f3e263..ef1220f3 100644 --- a/test/integration/config.spec.ts +++ b/test/integration/config.spec.ts @@ -153,9 +153,6 @@ describe('config', () => { }); it('reads and exposes MAC addresses', async () => { - // FIXME: this variable defaults to `/mnt/root/sys/class/net`. The supervisor runs with network_mode: host - // which means that it can just use the container `/sys/class/net` and the result should be the same - constants.macAddressPath = '/sys/class/net'; const macAddress = await conf.get('macAddress'); expect(macAddress).to.have.length.greaterThan(0); }); diff --git a/test/legacy/10-api-binder.spec.ts b/test/legacy/10-api-binder.spec.ts index 009052b5..679d3660 100644 --- a/test/legacy/10-api-binder.spec.ts +++ b/test/legacy/10-api-binder.spec.ts @@ -15,6 +15,7 @@ import * as TargetState from '~/src/device-state/target-state'; import * as ApiHelper from '~/lib/api-helper'; import supervisorVersion = require('~/lib/supervisor-version'); import * as eventTracker from '~/src/event-tracker'; +import * as constants from '~/lib/constants'; import { TypedError } from 'typed-error'; import { DeviceNotFoundError } from '~/lib/errors'; @@ -65,6 +66,10 @@ describe('ApiBinder', () => { spy(balenaAPI.balenaBackend!, 'registerHandler'); server = balenaAPI.listen(3000); + + // TODO: remove when moving this suite to integration tests + // @ts-expect-error + constants.macAddressPath = './test/data/sys/class/net'; }); after(() => { @@ -75,6 +80,10 @@ describe('ApiBinder', () => { } catch (error) { /* noop */ } + + // TODO: remove when moving this suite to integration tests + // @ts-expect-error + constants.macAddressPath = '/sys/class/net'; }); // We do not support older OS versions anymore, so we only test this case