Ejemplo n.º 1
0
 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("loc_mock_ToolToInstall sdk 1.0.4") > -1, "should print to-be-installed info");
     assert(tr.stdout.indexOf("Checking local tool for dncs and version 1.0.4") > -1, "should check for local cached tool");
     assert(tr.stdout.indexOf("loc_mock_InstallingAfresh") == -1, "should not install fresh");
     assert(tr.stdout.indexOf("loc_mock_GettingDownloadUrls") == -1, "should not download");
     assert(tr.stdout.indexOf("loc_mock_UsingCachedTool") > -1, "should print that cached dir is being used");
     assert(tr.stdout.indexOf("Caching dir C:\\agent\\_temp\\someDir for tool dncs version 1.0.4") == -1, "should not update cache again");
     assert(tr.stdout.indexOf("prepending path: C:\\agent\\_tools\\oldCacheDir") > -1, "should pre-prend to PATH");
 }, tr, done);
Ejemplo n.º 2
0
 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("virtualMachineExtensions.list is called") > -1, "virtualMachineExtensions.list function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.deleteMethod is called with resource testvmss1 and extension AzureVmssDeploymentTask") == -1, "virtualMachineExtensions.deleteMethod function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.createOrUpdate is called with resource testvmss1 and extension AzureVmssDeploymentTask") > -1, "virtualMachineExtensions.createOrUpdate function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachinesScaleSets.updateImage is called with RG: testrg1, VMSS: testvmss1 and imageurl : https://someurl") > -1, "virtualMachinesScaleSets.updateImage function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("loc_mock_GetVMSSExtensionsListFailed") >= -1, "ahould warn about list failure");
     assert(tr.stdout.indexOf("loc_mock_CustomScriptExtensionInstalled") > -1, "new extension should be installed");
     assert(tr.stdout.indexOf("loc_mock_UpdatedVMSSImage") > -1, "VMSS image should be updated");
 }, tr, done);
Ejemplo n.º 3
0
 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("virtualMachineExtensions.list is called") > -1, "virtualMachineExtensions.list function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.deleteMethod is called with resource testvmss1 and extension CustomScriptExtension1") == -1, "virtualMachineExtensions.deleteMethod function should not have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.createOrUpdate is called with resource testvmss1 and extension CustomScriptExtension") > -1, "virtualMachineExtensions.createOrUpdate function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachinesScaleSets.updateImage is called with RG: testrg1, VMSS: testvmss1 and imageurl : https://someurl") > -1, "virtualMachinesScaleSets.updateImage function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("loc_mock_RemovingCustomScriptExtension") == -1, "removing old extension");
     assert(tr.stdout.indexOf("loc_mock_CustomScriptExtensionInstalled") > -1, "new extension should be installed");
     assert(tr.stdout.indexOf("loc_mock_UpdatedVMSSImage") > -1, "VMSS image should be updated");
 }, tr, done);
Ejemplo n.º 4
0
 it("correctly handles being instantiated with empty list of handlers", () => {
   const spy = sinon.spy();
   const stub_logger = {infoD: spy};
   const log = new middleware.ContextLogger(stub_logger, [], fake_req);
   log.info("test_title");
   const expected_context = {};
   assert(spy.calledWithExactly("test_title", expected_context));
   assert.equal(spy.callCount, 1);
 });
Ejemplo n.º 5
0
export function loadConfigFromFile(fname: string): AppConfig {
  var jsonText = fs.readFileSync(fname, {encoding: "utf-8"});
  var config = JSON.parse(jsonText);
  assert(config.htmlSrcs !== void 0);
  if (config.dataDir === void 0) {
    config.dataDir = defaultValues.dataDir;
  }
  return config;
}
Ejemplo n.º 6
0
    it('returns acceptable version ranges for queries', async function() {
      // Set in 3 different transactions so we get a document version range.
      const {source, version: v1} = await setSingle(this.store, 'a', 1)
      const v2 = (await setSingle(this.store, 'b', 2)).version
      const v3 = (await setSingle(this.store, 'c', 3)).version

      assert(vCmp(v1, v2) < 0 && vCmp(v2, v3) < 0)
      await assertKVResults(this.store, ['a'], [v3], [['a', 1]], sparseSV(source, this.store, {from:v1, to:v3}))
    })
Ejemplo n.º 7
0
 logStub = sinon.stub(consoleio, 'log').callsFake(function(string, object) {
   process.stdout.write(string + '\n')
   var expectedString = '999'
   var expectedOutput = string.indexOf(expectedString) > -1
   assert(
     expectedOutput,
     'expected logger output to contain "' + expectedString + '"'
   )
 })
 it('should query analytics', async () => {
   const siteUrl = 'http://jbeckwith.com';
   const path = `/webmasters/v3/sites/${
       encodeURIComponent(siteUrl)}/searchAnalytics/query`;
   const scope = nock(Utils.baseUrl).post(path).reply(200, {});
   const data = await samples.query.runSample();
   assert(data);
   scope.done();
 });
Ejemplo n.º 9
0
 utils.parseJsonFromFile(example).then((parsedData: unknown) => {
   var valid = syntaxContext.validator.validate(parsedData, syntaxContext.exampleSchema);
 if (!valid) {
   var error = syntaxContext.validator.getLastErrors();
   throw new Error("Schema validation failed: " + util.inspect(error, { depth: null }));
 }
 assert(valid === true);
 done();
 });
 localApis.forEach(name => {
   if (g2[name] === null) {
     // Warn if an API remains null (was not found during the discovery
     // process) to avoid failing the test.
     console.warn(name + ' was not found.');
   } else {
     assert(g2[name]);
   }
 });