Change macAddressPath to /sys/class/net

Previously it was set at /mnt/root/sys/class/net, which is
the same as /sys/class/net because Supervisor has a network
mode of `host`.

Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
Christina Ying Wang
2022-11-08 15:51:14 -08:00
parent 75bf2aa3b4
commit 57f4dcbcac
3 changed files with 10 additions and 6 deletions

View File

@ -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