@f5devcentral/f5-cloud-libs-gce
Advanced tools
Comparing version 2.5.0 to 2.7.0
{ | ||
"name": "@f5devcentral/f5-cloud-libs-gce", | ||
"version": "2.5.0", | ||
"version": "2.7.0", | ||
"description": "Google Cloud implementation of f5-cloud-libs cloud provider code", | ||
@@ -18,4 +18,8 @@ "keywords": [ | ||
}, | ||
"auditProcessor": { | ||
"whitelist": [] | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@f5devcentral/f5-cloud-libs": "^4.22.0-beta.1", | ||
"@google-cloud/compute": "^0.10.0", | ||
@@ -35,10 +39,12 @@ "@google-cloud/storage": "^1.7.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"nodeunit": "^0.11.3" | ||
"eslint-plugin-mocha": "^8.0.0", | ||
"mocha": "^7.1.1" | ||
}, | ||
"scripts": { | ||
"audit": "npm audit --json > .auditReport.json; node scripts/auditProcessor.js", | ||
"lint": "node node_modules/eslint/bin/eslint lib src scripts", | ||
"package": "bash ./package.sh", | ||
"test": "node node_modules/nodeunit/bin/nodeunit --reporter eclipse test test/lib", | ||
"test": "mocha --exit test/lib", | ||
"version": "./setVersion.sh $npm_package_version && git add ." | ||
} | ||
} |
@@ -20,65 +20,66 @@ /** | ||
const q = require('q'); | ||
const assert = require('assert'); | ||
const region = 'aRegion'; | ||
const clientId = 'aClient'; | ||
const projectId = 'aProject'; | ||
const credentials = { | ||
foo: 'bar' | ||
}; | ||
describe('failover tests', () => { | ||
const region = 'aRegion'; | ||
const clientId = 'aClient'; | ||
const projectId = 'aProject'; | ||
const credentials = { | ||
foo: 'bar' | ||
}; | ||
const instanceId = 'this_is_my_instance_id'; | ||
const instanceId = 'this_is_my_instance_id'; | ||
const vm1 = { | ||
name: 'vm1', | ||
metadata: { | ||
status: 'RUNNING', | ||
}, | ||
getMetadata() { | ||
return q( | ||
[{ | ||
networkInterfaces: [ | ||
{ | ||
networkIP: '1.2.3.4', | ||
accessConfigs: [ | ||
{ | ||
natIP: '5.6.7.8' | ||
} | ||
] | ||
} | ||
] | ||
}] | ||
); | ||
} | ||
}; | ||
const vm1 = { | ||
name: 'vm1', | ||
metadata: { | ||
status: 'RUNNING', | ||
}, | ||
getMetadata() { | ||
return q( | ||
[{ | ||
networkInterfaces: [ | ||
{ | ||
networkIP: '1.2.3.4', | ||
accessConfigs: [ | ||
{ | ||
natIP: '5.6.7.8' | ||
} | ||
] | ||
} | ||
] | ||
}] | ||
); | ||
} | ||
}; | ||
const instance1 = { | ||
id: 'vm1', | ||
isPrimary: false | ||
}; | ||
const instance1 = { | ||
id: 'vm1', | ||
isPrimary: false | ||
}; | ||
let CloudProvider; | ||
let GceCloudProvider; | ||
let provider; | ||
let CloudProvider; | ||
let GceCloudProvider; | ||
let provider; | ||
let cloudUtilMock; | ||
let computeMock; | ||
let fsMock; | ||
let cloudUtilMock; | ||
let computeMock; | ||
let fsMock; | ||
let createReadStream; | ||
let createReadStream; | ||
const passedParams = { | ||
storage: {}, | ||
storageBucket: { | ||
fileDeleteParams: [] | ||
} | ||
}; | ||
let storageBucketFileDeleteCalled = false; | ||
const passedParams = { | ||
storage: {}, | ||
storageBucket: { | ||
fileDeleteParams: [] | ||
} | ||
}; | ||
let storageBucketFileDeleteCalled = false; | ||
const vmSetTagsParams = {}; | ||
const vmSetTagsParams = {}; | ||
// Our tests cause too many event listeners. Turn off the check. | ||
process.setMaxListeners(0); | ||
// Our tests cause too many event listeners. Turn off the check. | ||
process.setMaxListeners(0); | ||
module.exports = { | ||
setUp(callback) { | ||
beforeEach(() => { | ||
/* eslint-disable global-require */ | ||
@@ -109,7 +110,5 @@ cloudUtilMock = require('@f5devcentral/f5-cloud-libs').util; | ||
createReadStream = fsMock.createReadStream; | ||
}); | ||
callback(); | ||
}, | ||
tearDown(callback) { | ||
afterEach(() => { | ||
Object.keys(require.cache).forEach((key) => { | ||
@@ -119,7 +118,6 @@ delete require.cache[key]; | ||
fsMock.createReadStream = createReadStream; | ||
callback(); | ||
}, | ||
}); | ||
testInit: { | ||
testCredentials(test) { | ||
describe('init tests', () => { | ||
it('credentials test', (done) => { | ||
const secretBase64 = cloudUtilMock.createBufferFrom( | ||
@@ -136,13 +134,13 @@ JSON.stringify(credentials) | ||
.then(() => { | ||
test.deepEqual(provider.compute.authClient.config.credentials, credentials); | ||
assert.deepEqual(provider.compute.authClient.config.credentials, credentials); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testCredentialsNoRegion(test) { | ||
it('credentials no region test', (done) => { | ||
const secretBase64 = cloudUtilMock.createBufferFrom( | ||
@@ -158,41 +156,41 @@ JSON.stringify(credentials) | ||
.then(() => { | ||
test.ok(false, 'Should have thrown no region'); | ||
assert.ok(false, 'Should have thrown no region'); | ||
}) | ||
.catch((err) => { | ||
test.notStrictEqual(err.message.indexOf('region is required'), -1); | ||
assert.notStrictEqual(err.message.indexOf('region is required'), -1); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testNoCredentials(test) { | ||
it('no credentials test', (done) => { | ||
const providerOptions = { region }; | ||
provider.init(providerOptions) | ||
.then(() => { | ||
test.strictEqual(provider.region, region); | ||
assert.strictEqual(provider.region, region); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testNoCredentialsNoRegion(test) { | ||
it('no credentials no region test', (done) => { | ||
const providerOptions = {}; | ||
provider.init(providerOptions) | ||
.then(() => { | ||
test.strictEqual(provider.region, region); | ||
assert.strictEqual(provider.region, region); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testStorageBucketNoCredentials(test) { | ||
it('storage bucket no credentials test', (done) => { | ||
const storageBucket = 'gcp-storage-bucket'; | ||
@@ -202,16 +200,16 @@ const providerOptions = { storageBucket }; | ||
.then(() => { | ||
test.strictEqual(provider.region, region); | ||
test.strictEqual(provider.storageBucket.name, storageBucket); | ||
assert.strictEqual(provider.region, region); | ||
assert.strictEqual(provider.storageBucket.name, storageBucket); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
testGetDataFromUri: { | ||
setUp(callback) { | ||
describe('get data from uri tests', () => { | ||
beforeEach(() => { | ||
provider.storage = { | ||
@@ -235,68 +233,63 @@ bucket(bucketParams) { | ||
}; | ||
callback(); | ||
}, | ||
}); | ||
testBasic(test) { | ||
test.expect(3); | ||
it('basic test', (done) => { | ||
provider.getDataFromUri('gs://myBucket/myFilename') | ||
.then((data) => { | ||
test.strictEqual(passedParams.storage.bucketParams, 'myBucket'); | ||
test.strictEqual(passedParams.storage.fileParams, 'myFilename'); | ||
test.strictEqual(data.key, 'value'); | ||
assert.strictEqual(passedParams.storage.bucketParams, 'myBucket'); | ||
assert.strictEqual(passedParams.storage.fileParams, 'myFilename'); | ||
assert.strictEqual(data.key, 'value'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testComplexKey(test) { | ||
test.expect(3); | ||
it('complex key test', (done) => { | ||
provider.getDataFromUri('gs://myBucket/myFolder/myFilename') | ||
.then((data) => { | ||
test.strictEqual(passedParams.storage.bucketParams, 'myBucket'); | ||
test.strictEqual(passedParams.storage.fileParams, 'myFolder/myFilename'); | ||
test.strictEqual(data.key, 'value'); | ||
assert.strictEqual(passedParams.storage.bucketParams, 'myBucket'); | ||
assert.strictEqual(passedParams.storage.fileParams, 'myFolder/myFilename'); | ||
assert.strictEqual(data.key, 'value'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testInvalidUri(test) { | ||
test.expect(1); | ||
it('invalid uri test', (done) => { | ||
provider.getDataFromUri('https://console.cloud.google.com/storage/browser/bucket/key') | ||
.then(() => { | ||
test.ok(false, 'Should have thrown invalid URI'); | ||
assert.ok(false, 'Should have thrown invalid URI'); | ||
}) | ||
.catch((err) => { | ||
test.notStrictEqual(err.message.indexOf('Invalid URI'), -1); | ||
assert.notStrictEqual(err.message.indexOf('Invalid URI'), -1); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testInvalidArn(test) { | ||
test.expect(1); | ||
it('invalid arn test', (done) => { | ||
provider.getDataFromUri('gs://myBucket/') | ||
.then(() => { | ||
test.ok(false, 'Should have thrown invalid URI'); | ||
assert.ok(false, 'Should have thrown invalid URI'); | ||
}) | ||
.catch((err) => { | ||
test.notStrictEqual(err.message.indexOf('Invalid URI'), -1); | ||
assert.notStrictEqual(err.message.indexOf('Invalid URI'), -1); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
testUCSFunctions: { | ||
setUp(cb) { | ||
describe('ucs functions tests', () => { | ||
beforeEach(() => { | ||
provider.storageBucket = { | ||
@@ -371,72 +364,66 @@ file(fileName) { | ||
}; | ||
}); | ||
cb(); | ||
}, | ||
afterEach(() => { | ||
storageBucketFileDeleteCalled = false; | ||
passedParams.storageBucket.fileDeleteParams = []; | ||
}); | ||
testDeleteStoredUcs(test) { | ||
it('delete stored ucs test', (done) => { | ||
storageBucketFileDeleteCalled = false; | ||
test.expect(2); | ||
provider.deleteStoredUcs('foo.ucs') | ||
.then(() => { | ||
test.ok(storageBucketFileDeleteCalled); | ||
test.strictEqual(passedParams.storageBucket.fileDeleteParams[0], 'backup/foo.ucs'); | ||
assert.ok(storageBucketFileDeleteCalled); | ||
assert.strictEqual(passedParams.storageBucket.fileDeleteParams[0], 'backup/foo.ucs'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testStoreUCS(test) { | ||
it('store ucs test', (done) => { | ||
const ucsFileName = 'ucsAutosave_123.ucs'; | ||
const ucsFilePath = `/var/local/ucs/${ucsFileName}`; | ||
test.expect(3); | ||
provider.storeUcs(ucsFilePath, 7, 'ucsAutosave_') | ||
.then(() => { | ||
test.strictEqual(passedParams.storageBucket.fileParams, `backup/${ucsFileName}`); | ||
test.strictEqual(passedParams.storageBucket.fileSaveParams, 'string data'); | ||
test.strictEqual(storageBucketFileDeleteCalled, false); | ||
assert.strictEqual(passedParams.storageBucket.fileParams, `backup/${ucsFileName}`); | ||
assert.strictEqual(passedParams.storageBucket.fileSaveParams, 'string data'); | ||
assert.strictEqual(storageBucketFileDeleteCalled, false); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testStoreUCSDeleteOldestObjects(test) { | ||
it('store ucs delete oldest objects test', (done) => { | ||
const ucsFileName = 'ucsAutosave_123.ucs'; | ||
const ucsFilePath = `/var/local/ucs/${ucsFileName}`; | ||
test.expect(3); | ||
provider.storeUcs(ucsFilePath, 2, 'ucsAutosave_') | ||
.then(() => { | ||
test.deepEqual(passedParams.storageBucket.getFiles, { prefix: 'backup/' }); | ||
test.deepEqual( | ||
assert.deepEqual(passedParams.storageBucket.getFiles, { prefix: 'backup/' }); | ||
assert.deepEqual( | ||
passedParams.storageBucket.fileDeleteParams, | ||
['backup/ucsAutosave_123.ucs', 'backup/ucsAutosave_234.ucs'] | ||
); | ||
test.strictEqual(storageBucketFileDeleteCalled, true); | ||
assert.strictEqual(storageBucketFileDeleteCalled, true); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
}); | ||
tearDown(cb) { | ||
storageBucketFileDeleteCalled = false; | ||
passedParams.storageBucket.fileDeleteParams = []; | ||
cb(); | ||
} | ||
}, | ||
testElectPrimary: { | ||
testBasic(test) { | ||
describe('elect primary tests', () => { | ||
it('basic test', (done) => { | ||
const instances = { | ||
@@ -455,16 +442,15 @@ 1: { | ||
test.expect(1); | ||
provider.electPrimary(instances) | ||
.then((response) => { | ||
test.strictEqual(response, '1'); | ||
assert.strictEqual(response, '1'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testProviderNotVisible(test) { | ||
it('provider not visible test', (done) => { | ||
const instances = { | ||
@@ -483,16 +469,15 @@ 1: { | ||
test.expect(1); | ||
provider.electPrimary(instances) | ||
.then((response) => { | ||
test.strictEqual(response, '2'); | ||
assert.strictEqual(response, '2'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testVersionNotOk(test) { | ||
it('version not ok test', (done) => { | ||
const instances = { | ||
@@ -511,16 +496,15 @@ 1: { | ||
test.expect(1); | ||
provider.electPrimary(instances) | ||
.then((response) => { | ||
test.strictEqual(response, '2'); | ||
assert.strictEqual(response, '2'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testExternal(test) { | ||
it('external test', (done) => { | ||
const instances = { | ||
@@ -540,32 +524,30 @@ 1: { | ||
test.expect(1); | ||
provider.electPrimary(instances) | ||
.then((response) => { | ||
test.strictEqual(response, '2'); | ||
assert.strictEqual(response, '2'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
testGetInstanceId(test) { | ||
test.expect(1); | ||
it('get instance id test', (done) => { | ||
provider.getInstanceId() | ||
.then((response) => { | ||
test.strictEqual(response, instanceId); | ||
assert.strictEqual(response, instanceId); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testGetInstances: { | ||
setUp(cb) { | ||
describe('get instances tests', () => { | ||
beforeEach(() => { | ||
computeMock.zone = function zone() { | ||
@@ -615,22 +597,20 @@ return { | ||
provider.compute = computeMock; | ||
cb(); | ||
}, | ||
}); | ||
testBasic(test) { | ||
test.expect(3); | ||
it('basic test', (done) => { | ||
provider.getInstances() | ||
.then((response) => { | ||
test.strictEqual(Object.keys(response).length, 1); | ||
test.deepEqual(response.vm1.id, instance1.id); | ||
test.deepEqual(response.vm1.isPrimary, instance1.isPrimary); | ||
assert.strictEqual(Object.keys(response).length, 1); | ||
assert.deepEqual(response.vm1.id, instance1.id); | ||
assert.deepEqual(response.vm1.isPrimary, instance1.isPrimary); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testExternalInstances(test) { | ||
it('external instances test', (done) => { | ||
computeMock.zone = function zone() { | ||
@@ -664,17 +644,16 @@ return { | ||
test.expect(2); | ||
provider.getInstances({ externalTag: 'foo' }) | ||
.then((response) => { | ||
test.strictEqual(Object.keys(response).length, 2); | ||
test.deepEqual(response.vm2.external, true); | ||
assert.strictEqual(Object.keys(response).length, 2); | ||
assert.deepEqual(response.vm2.external, true); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testMissingInstances(test) { | ||
it('missing instances test', (done) => { | ||
provider.storageBucket = { | ||
@@ -686,18 +665,17 @@ getFiles() { | ||
test.expect(2); | ||
provider.getInstances() | ||
.then((response) => { | ||
test.strictEqual(Object.keys(response).length, 1); | ||
test.deepEqual(response.vm1.privateIp, '1.2.3.4'); | ||
assert.strictEqual(Object.keys(response).length, 1); | ||
assert.deepEqual(response.vm1.privateIp, '1.2.3.4'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
testGetMessages(test) { | ||
it('get messages test', (done) => { | ||
const message1 = 'i am message 1'; | ||
@@ -723,34 +701,32 @@ const message2 = 'i am message 2'; | ||
test.expect(2); | ||
provider.getMessages([CloudProvider.MESSAGE_SYNC_COMPLETE], { toInstanceId: '1' }) | ||
.then((response) => { | ||
test.strictEqual(response.length, 1); | ||
test.strictEqual(response[0].message, message1); | ||
assert.strictEqual(response.length, 1); | ||
assert.strictEqual(response[0].message, message1); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testGetNicsByTag: { | ||
testBasic(test) { | ||
test.expect(1); | ||
describe('get nics by tag tests', () => { | ||
it('basic test', (done) => { | ||
provider.getNicsByTag('foo') | ||
.then((response) => { | ||
test.strictEqual(response.length, 0); | ||
assert.strictEqual(response.length, 0); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
testGetVmsByTag: { | ||
testBasic(test) { | ||
describe('get vms by tag tests', () => { | ||
it('basic test', (done) => { | ||
const myTag = { | ||
@@ -798,7 +774,6 @@ key: 'foo', | ||
test.expect(2); | ||
provider.getVmsByTag(myTag) | ||
.then((response) => { | ||
test.deepEqual(passedOptions, { filter: `labels.${myTag.key} eq ${myTag.value}` }); | ||
test.deepEqual( | ||
assert.deepEqual(passedOptions, { filter: `labels.${myTag.key} eq ${myTag.value}` }); | ||
assert.deepEqual( | ||
response[0], | ||
@@ -815,10 +790,10 @@ { | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testNoResults(test) { | ||
it('no results test', (done) => { | ||
const myTag = { | ||
@@ -835,32 +810,30 @@ key: 'foo', | ||
test.expect(); | ||
provider.getVmsByTag(myTag) | ||
.then((response) => { | ||
test.strictEqual(response.length, 0); | ||
assert.strictEqual(response.length, 0); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err.message); | ||
assert.ok(false, err.message); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testBadTag(test) { | ||
it('bad tag test', (done) => { | ||
const myTag = 'foo'; | ||
test.expect(1); | ||
provider.getVmsByTag(myTag) | ||
.then(() => { | ||
test.ok(false, 'getVmsByTag should have thrown'); | ||
assert.ok(false, 'getVmsByTag should have thrown'); | ||
}) | ||
.catch((err) => { | ||
test.notStrictEqual(err.message.indexOf('key and value'), -1); | ||
assert.notStrictEqual(err.message.indexOf('key and value'), -1); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}); | ||
testError(test) { | ||
it('error test', (done) => { | ||
const myTag = { | ||
@@ -877,17 +850,17 @@ key: 'foo', | ||
test.expect(1); | ||
provider.getVmsByTag(myTag) | ||
.then(() => { | ||
test.ok(false, 'getVmsByTag should have thrown'); | ||
assert.ok(false, 'getVmsByTag should have thrown'); | ||
}) | ||
.catch((err) => { | ||
test.strictEqual(err.message, 'uh oh'); | ||
assert.strictEqual(err.message, 'uh oh'); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}, | ||
testTagPrimary: { | ||
setUp(callback) { | ||
}); | ||
}); | ||
describe('tag primary tests', () => { | ||
beforeEach(() => { | ||
const instances = { | ||
@@ -936,6 +909,5 @@ 'bigip-bf4b': { | ||
provider.compute = computeMock; | ||
callback(); | ||
}, | ||
}); | ||
testTagPrimaryInstance(test) { | ||
it('tag primary instance test', (done) => { | ||
provider.providerOptions = { | ||
@@ -958,20 +930,19 @@ instanceGroup: 'foo' | ||
test.expect(4); | ||
provider.tagPrimaryInstance(primaryIid, instances) | ||
.then(() => { | ||
test.strictEqual(vmSetTagsParams['bigip-uuio'], undefined); | ||
test.strictEqual(vmSetTagsParams['bigip-jjzs'].tags.indexOf('foo-primary'), -1); | ||
test.notStrictEqual(vmSetTagsParams[primaryIid].tags.indexOf('foo-primary'), -1); | ||
test.strictEqual(vmSetTagsParams[primaryIid].fingerprint, 'fingerprint'); | ||
assert.strictEqual(vmSetTagsParams['bigip-uuio'], undefined); | ||
assert.strictEqual(vmSetTagsParams['bigip-jjzs'].tags.indexOf('foo-primary'), -1); | ||
assert.notStrictEqual(vmSetTagsParams[primaryIid].tags.indexOf('foo-primary'), -1); | ||
assert.strictEqual(vmSetTagsParams[primaryIid].fingerprint, 'fingerprint'); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
}, | ||
}, | ||
}); | ||
}); | ||
testPrimaryElected(test) { | ||
it('primary elected test', (done) => { | ||
let instanceIdSent; | ||
@@ -1047,12 +1018,12 @@ let instanceSent; | ||
.then(() => { | ||
test.strictEqual(instanceIdSent, 'vm2'); | ||
test.strictEqual(instanceSent.isPrimary, false); | ||
assert.strictEqual(instanceIdSent, 'vm2'); | ||
assert.strictEqual(instanceSent.isPrimary, false); | ||
}) | ||
.catch((err) => { | ||
test.ok(false, err); | ||
assert.ok(false, err); | ||
}) | ||
.finally(() => { | ||
test.done(); | ||
done(); | ||
}); | ||
} | ||
}; | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3325
135228
8
5
11
4
+ Added@f5devcentral/f5-cloud-libs@4.29.0(transitive)
- Removed@f5devcentral/f5-cloud-libs@4.28.1-beta.1(transitive)