Replace offline -> unmanaged in logs and tests

Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2018-12-17 10:52:40 +00:00
parent c533631f70
commit 96b614ad6a
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
3 changed files with 10 additions and 10 deletions

View File

@ -75,7 +75,7 @@ module.exports = class APIBinder
@config.getMany([ 'unmanaged', 'apiEndpoint', 'currentApiKey' ])
.then ({ unmanaged, apiEndpoint, currentApiKey }) =>
if unmanaged
console.log('Offline Mode is set, skipping API client initialization')
console.log('Unmanaged Mode is set, skipping API client initialization')
return
baseUrl = url.resolve(apiEndpoint, '/v5/')
passthrough = _.cloneDeep(requestOpts)
@ -105,7 +105,7 @@ module.exports = class APIBinder
@config.getMany([ 'apiEndpoint', 'unmanaged', 'bootstrapRetryDelay' ])
.then ({ apiEndpoint, unmanaged, bootstrapRetryDelay }) =>
if unmanaged
console.log('Offline Mode is set, skipping API binder initialization')
console.log('Unmanaged Mode is set, skipping API binder initialization')
# If we are offline because there is no apiEndpoint, there's a chance
# we've went through a deprovision. We need to set the initialConfigReported
# value to '', to ensure that when we do re-provision, we'll report
@ -266,7 +266,7 @@ module.exports = class APIBinder
])
.then (conf) =>
if conf.unmanaged
throw new Error('Cannot provision dependent device in offline mode')
throw new Error('Cannot provision dependent device in unmanaged mode')
if !conf.provisioned
throw new Error('Device must be provisioned to provision a dependent device')
# TODO: when API supports it as per https://github.com/resin-io/hq/pull/949 remove userId
@ -289,7 +289,7 @@ module.exports = class APIBinder
])
.then (conf) =>
if conf.unmanaged
throw new Error('Cannot update dependent device in offline mode')
throw new Error('Cannot update dependent device in unmanaged mode')
if !conf.provisioned
throw new Error('Device must be provisioned to update a dependent device')
@balenaApi.patch

View File

@ -23,7 +23,7 @@ describe 'EventTracker', ->
EventTracker.prototype.logEvent.restore()
mixpanel.init.restore()
it 'initializes in offline mode', ->
it 'initializes in unmanaged mode', ->
promise = @eventTrackerOffline.init({
unmanaged: true
uuid: 'foobar'
@ -33,11 +33,11 @@ describe 'EventTracker', ->
.then =>
expect(@eventTrackerOffline.client).to.be.null
it 'logs events in offline mode, with the correct properties', ->
it 'logs events in unmanaged mode, with the correct properties', ->
@eventTrackerOffline.track('Test event', { appId: 'someValue' })
expect(@eventTrackerOffline.logEvent).to.be.calledWith('Event:', 'Test event', JSON.stringify({ appId: 'someValue' }))
it 'initializes a mixpanel client when not in offline mode', ->
it 'initializes a mixpanel client when not in unmanaged mode', ->
promise = @eventTracker.init({
mixpanelToken: 'someToken'
uuid: 'barbaz'

View File

@ -135,11 +135,11 @@ describe 'APIBinder', ->
@apiBinder.fetchDevice.restore()
balenaAPI.balenaBackend.deviceKeyHandler.restore()
describe 'offline mode', ->
describe 'unmanaged mode', ->
before ->
initModels.call(this, '/config-apibinder-offline.json')
it 'does not generate a key if the device is in offline mode', ->
it 'does not generate a key if the device is in unmanaged mode', ->
@config.get('unmanaged').then (mode) =>
# Ensure offline mode is set
expect(mode).to.equal(true)
@ -148,7 +148,7 @@ describe 'APIBinder', ->
expect(conf['deviceApiKey']).to.be.empty
expect(conf['uuid']).to.not.be.undefined
describe 'Minimal config offline mode', ->
describe 'Minimal config unmanaged mode', ->
before ->
initModels.call(this, '/config-apibinder-offline2.json')