コード例 #1
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should tell whether the specified string matches the agent's information", () => {
   const agent = Agents.Agent.fromJSON(agentData[0]);
   expect(agent.matches('host-1')).toBe(true);
   expect(agent.matches("Linux")).toBe(true);
   expect(agent.matches("10.12.2.201")).toBe(true);
   expect(agent.matches("linux")).toBe(true);
   expect(agent.matches("perf")).toBe(true);
   expect(agent.matches("invalid-search")).toBe(false);
 });
コード例 #2
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
  it("should serialize to JSON", () => {
    const agent = Agents.Agent.fromJSON(agentData[0]);

    expect(JSON.parse(JSON.stringify(agent, s.snakeCaser))).toEqual({
      hostname:           'host-1',
      resources:          ['linux', 'java'],
      environments:       ['staging', 'perf'],
      agent_config_state: 'Enabled' // eslint-disable-line camelcase
    });
  });
コード例 #3
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should deserialize from json", () => {
   const agent = Agents.Agent.fromJSON(agentData[0]);
   expect(agent.uuid()).toBe('uuid-1');
   expect(agent.hostname()).toBe('host-1');
   expect(agent.ipAddress()).toBe('10.12.2.201');
   expect(agent.sandbox()).toBe('/var/lib/go-agent-2');
   expect(agent.operatingSystem()).toBe('Linux');
   expect(agent.freeSpace()).toBe(111902543872);
   expect(agent.agentConfigState()).toBe('Enabled');
   expect(agent.agentState()).toBe('Building');
   expect(agent.buildState()).toBe('Unknown');
   expect(agent.resources()).toEqual(['linux', 'java']);
   expect(agent.environments().length).toBe(2);
   expect(agent.environments()[0].name()).toEqual('staging');
   expect(agent.environments()[1].name()).toEqual('perf');
   expect(agent.environments()[0].associatedFromConfigRepo()).toBe(true);
   expect(agent.environments()[1].associatedFromConfigRepo()).toBe(false);
   expect(agent.buildDetails().pipelineUrl()).toEqual("http://localhost:8153/go/tab/pipeline/history/up42");
   expect(agent.buildDetails().stageUrl()).toEqual("http://localhost:8153/go/pipelines/up42/2/up42_stage/1");
   expect(agent.buildDetails().jobUrl()).toEqual("http://localhost:8153/go/tab/build/detail/up42/2/up42_stage/1/up42_job");
 });
コード例 #4
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be 'Building (Cancelled)' when agentState is 'Building' and buildState is 'Cancelled'", () => {
   const agent = new Agents.Agent({agentState: 'Building', buildState: 'Cancelled'});
   expect(agent.status()).toBe('Building (Cancelled)');
 });
コード例 #5
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be 'Disabled' when agentConfigState is 'Disabled'", () => {
   const agent = new Agents.Agent({agentConfigState: 'Disabled'});
   expect(agent.status()).toBe('Disabled');
 });
コード例 #6
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be 'Disabled (Cancelled)' when agentConfigState is 'Disabled' and buildState is 'Cancelled'", () => {
   const agent = new Agents.Agent({agentConfigState: 'Disabled', buildState: 'Cancelled'});
   expect(agent.status()).toBe('Disabled (Cancelled)');
 });
コード例 #7
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be pending when agentConfigState is Pending", () => {
   const agent = new Agents.Agent({agentConfigState: 'Pending'});
   expect(agent.status()).toBe('Pending');
 });
コード例 #8
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should default resource to be empty if no resource provided", () => {
   const elasticAgentData = agentData[7];
   const agent            = Agents.Agent.fromJSON(elasticAgentData);
   expect(agent.resources()).toEqual([]);
 });
コード例 #9
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be able to say elastic agent or not", () => {
   const elasticAgentData = agentData[7];
   const agent            = Agents.Agent.fromJSON(elasticAgentData);
   expect(agent.isElasticAgent()).toBeTruthy();
 });
コード例 #10
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should have elastic agent id and elastic plugin id", () => {
   const elasticAgentData = agentData[7];
   const agent            = Agents.Agent.fromJSON(elasticAgentData);
   expect(agent.elasticAgentId()).toBe('0039ddc8-38a0-4f7b-be15-522fcb6f8649');
   expect(agent.elasticPluginId()).toBe('cd.go.contrib.elastic-agent.docker');
 });
コード例 #11
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should tell whether the specified elastic agent id matches the agent's information", () => {
   const elasticAgentJSON = agentData[7];
   const agent            = Agents.Agent.fromJSON(elasticAgentJSON);
   expect(agent.matches(elasticAgentJSON.elastic_agent_id)).toBe(true);
 });
コード例 #12
0
ファイル: agents_spec.js プロジェクト: GaneshSPatil/gocd
 it("should be 'Building' when agentState is 'Building'", () => {
   const agent = new Agents.Agent({agentState: 'Building'});
   expect(agent.status()).toBe('Building');
 });