build_eval 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/build_eval/error.rb +11 -0
- data/lib/build_eval/http.rb +17 -3
- data/lib/build_eval/result/build_result.rb +2 -2
- data/lib/build_eval/result/status.rb +5 -4
- data/lib/build_eval/server/cruise_control_response.rb +22 -0
- data/lib/build_eval/server/decorator.rb +1 -1
- data/lib/build_eval/server/invalid_selector_error.rb +13 -0
- data/lib/build_eval/server/jenkins.rb +23 -0
- data/lib/build_eval/server/team_city.rb +2 -5
- data/lib/build_eval/server/travis.rb +3 -6
- data/lib/build_eval/version.rb +1 -1
- data/lib/build_eval.rb +7 -1
- data/spec/lib/build_eval/error_spec.rb +21 -0
- data/spec/lib/build_eval/http_shared_context.rb +7 -0
- data/spec/lib/build_eval/http_spec.rb +25 -5
- data/spec/lib/build_eval/result/build_result_spec.rb +4 -4
- data/spec/lib/build_eval/result/status_spec.rb +30 -11
- data/spec/lib/build_eval/server/cruise_control_response_spec.rb +115 -0
- data/spec/lib/build_eval/server/decorator_spec.rb +6 -6
- data/spec/lib/build_eval/server/invalid_selector_error_spec.rb +27 -0
- data/spec/lib/build_eval/server/jenkins_integration_spec.rb +52 -0
- data/spec/lib/build_eval/server/jenkins_spec.rb +70 -0
- data/spec/lib/build_eval/server/server_shared_examples.rb +15 -0
- data/spec/lib/build_eval/server/team_city_integration_spec.rb +85 -0
- data/spec/lib/build_eval/server/team_city_spec.rb +24 -88
- data/spec/lib/build_eval/server/travis_integration_spec.rb +53 -0
- data/spec/lib/build_eval/server/travis_spec.rb +33 -55
- data/spec/lib/build_eval_smoke_spec.rb +25 -0
- data/spec/spec_helper.rb +14 -6
- metadata +42 -4
@@ -0,0 +1,70 @@
|
|
1
|
+
describe BuildEval::Server::Jenkins do
|
2
|
+
include_context "stubbed http interactions"
|
3
|
+
|
4
|
+
let(:uri) { "https://some.jenkins.server" }
|
5
|
+
let(:constructor_args) { { uri: uri } }
|
6
|
+
|
7
|
+
let(:jenkins_server) { described_class.new(constructor_args) }
|
8
|
+
|
9
|
+
it_behaves_like "a continuous integration server" do
|
10
|
+
|
11
|
+
let(:server) { jenkins_server }
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#build_result" do
|
16
|
+
|
17
|
+
let(:build_name) { "some_build_name" }
|
18
|
+
let(:response) { instance_double(Net::HTTPResponse) }
|
19
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
20
|
+
let(:cruise_control_response) do
|
21
|
+
instance_double(BuildEval::Server::CruiseControlResponse, parse_result: build_result)
|
22
|
+
end
|
23
|
+
|
24
|
+
subject { jenkins_server.build_result(build_name) }
|
25
|
+
|
26
|
+
before(:example) do
|
27
|
+
allow(http).to receive(:get).and_return(response)
|
28
|
+
allow(BuildEval::Server::CruiseControlResponse).to receive(:new).and_return(cruise_control_response)
|
29
|
+
allow(cruise_control_response).to receive(:parse_result).and_return(build_result)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "issues a GET request for the build" do
|
33
|
+
expect(http).to receive(:get).with("#{uri}/cc.xml")
|
34
|
+
|
35
|
+
subject
|
36
|
+
end
|
37
|
+
|
38
|
+
it "creates a Cruise Control response containing the GET request response" do
|
39
|
+
expect(BuildEval::Server::CruiseControlResponse).to receive(:new).with(response)
|
40
|
+
|
41
|
+
subject
|
42
|
+
end
|
43
|
+
|
44
|
+
it "parses the Cruise Control response to return the project with a matching build name" do
|
45
|
+
expect(cruise_control_response).to receive(:parse_result).with(a_string_including(build_name))
|
46
|
+
|
47
|
+
subject
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns the parsed build result" do
|
51
|
+
expect(subject).to eql(build_result)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#to_s" do
|
57
|
+
|
58
|
+
subject { jenkins_server.to_s }
|
59
|
+
|
60
|
+
it "returns a string indicating it is a Jenkins server" do
|
61
|
+
expect(subject).to include("Jenkins server")
|
62
|
+
end
|
63
|
+
|
64
|
+
it "returns a string containing the username" do
|
65
|
+
expect(subject).to include(uri)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_examples_for "a continuous integration server" do
|
2
|
+
|
3
|
+
describe "constructor" do
|
4
|
+
|
5
|
+
subject { server }
|
6
|
+
|
7
|
+
it "creates a http object with any provided http configuration options" do
|
8
|
+
expect(BuildEval::Http).to receive(:new).with(constructor_args)
|
9
|
+
|
10
|
+
subject
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
describe BuildEval::Server::TeamCity, "integrating with a response parser", integration: true do
|
2
|
+
include_context "stubbed http interactions"
|
3
|
+
|
4
|
+
let(:uri) { "https://some.teamcity.server" }
|
5
|
+
|
6
|
+
let(:team_city_server) { described_class.new(uri: uri) }
|
7
|
+
|
8
|
+
describe "#build_result" do
|
9
|
+
|
10
|
+
let(:build_name) { "some_build_name" }
|
11
|
+
let(:response_message) { nil }
|
12
|
+
let(:response_body) { nil }
|
13
|
+
let(:response) { instance_double(Net::HTTPResponse, message: response_message, body: response_body) }
|
14
|
+
|
15
|
+
subject { team_city_server.build_result(build_name) }
|
16
|
+
|
17
|
+
before(:example) { allow(http).to receive(:get).and_return(response) }
|
18
|
+
|
19
|
+
context "when the server responds with build results" do
|
20
|
+
|
21
|
+
let(:latest_build_status) { "FAILED" }
|
22
|
+
let(:response_message) { "OK" }
|
23
|
+
let(:response_body) do
|
24
|
+
<<-RESPONSE
|
25
|
+
<builds count="3" href="/httpAuth/app/rest/buildTypes/#{build_name}/builds/" nextHref="/httpAuth/app/rest/buildTypes/#{build_name}/builds/?count=3&start=3">
|
26
|
+
<build id="87735" buildTypeId="#{build_name}" number="2062" status="#{latest_build_status}" state="finished" href="/httpAuth/app/rest/builds/id:87735" webUrl="#{uri}/viewLog.html?buildId=87735&buildTypeId=#{build_name}"/>
|
27
|
+
<build id="87723" buildTypeId="#{build_name}" number="2061" status="SUCCESS" state="finished" href="/httpAuth/app/rest/builds/id:87723" webUrl="#{uri}/viewLog.html?buildId=87723&buildTypeId=#{build_name}"/>
|
28
|
+
<build id="87658" buildTypeId="#{build_name}" number="2060" status="SUCCESS" state="finished" href="/httpAuth/app/rest/builds/id:87658" webUrl="#{uri}/viewLog.html?buildId=87658&buildTypeId=#{build_name}"/>
|
29
|
+
</builds>
|
30
|
+
RESPONSE
|
31
|
+
end
|
32
|
+
|
33
|
+
it "creates a build result containing the build name" do
|
34
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
35
|
+
|
36
|
+
subject
|
37
|
+
end
|
38
|
+
|
39
|
+
it "creates a build result containing the latest build status" do
|
40
|
+
expect(BuildEval::Result::BuildResult).to(
|
41
|
+
receive(:create).with(hash_including(status_name: latest_build_status))
|
42
|
+
)
|
43
|
+
|
44
|
+
subject
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns the created result" do
|
48
|
+
build_result = instance_double(BuildEval::Result::BuildResult)
|
49
|
+
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
50
|
+
|
51
|
+
expect(subject).to eql(build_result)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the server authentication request fails" do
|
57
|
+
|
58
|
+
let(:response_message) { "Unauthorized" }
|
59
|
+
let(:response_body) { "Incorrect username or password" }
|
60
|
+
|
61
|
+
it "raises an error" do
|
62
|
+
expect { subject }.to raise_error(/Unauthorized/)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when the build is not found" do
|
68
|
+
|
69
|
+
let(:response_message) { "Not Found" }
|
70
|
+
let(:response_body) do
|
71
|
+
<<-BODY
|
72
|
+
Error has occurred during request processing (Not Found).
|
73
|
+
Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No build type nor template is found by id '#{build_name}'.
|
74
|
+
BODY
|
75
|
+
end
|
76
|
+
|
77
|
+
it "raises an error" do
|
78
|
+
expect { subject }.to raise_error(/Not Found/)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
@@ -1,110 +1,46 @@
|
|
1
1
|
describe BuildEval::Server::TeamCity do
|
2
|
+
include_context "stubbed http interactions"
|
2
3
|
|
3
|
-
let(:uri)
|
4
|
-
let(:username)
|
5
|
-
let(:password)
|
4
|
+
let(:uri) { "https://some.teamcity.server" }
|
5
|
+
let(:username) { "some_username" }
|
6
|
+
let(:password) { "some_password" }
|
7
|
+
let(:constructor_args) { { uri: uri, username: username, password: password } }
|
6
8
|
|
7
|
-
let(:
|
9
|
+
let(:team_city_server) { described_class.new(constructor_args) }
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
let(:build_name) { "some_build_name" }
|
12
|
-
let(:response_code) { nil }
|
13
|
-
let(:response_message) { nil }
|
14
|
-
let(:response_body) { nil }
|
15
|
-
let(:response) do
|
16
|
-
instance_double(Net::HTTPResponse, code: response_code, message: response_message, body: response_body)
|
17
|
-
end
|
18
|
-
|
19
|
-
subject { team_city.build_result(build_name) }
|
20
|
-
|
21
|
-
before(:example) { allow(BuildEval::Http).to receive(:get).and_return(response) }
|
22
|
-
|
23
|
-
it "issues a get request for the build" do
|
24
|
-
expected_uri = "#{uri}/httpAuth/app/rest/buildTypes/id:#{build_name}/builds"
|
25
|
-
expect(BuildEval::Http).to receive(:get).with(expected_uri, anything)
|
26
|
-
|
27
|
-
subject rescue Exception
|
28
|
-
end
|
29
|
-
|
30
|
-
it "issues a get request with the provided basic authentication credentials" do
|
31
|
-
expect(BuildEval::Http).to receive(:get).with(anything, username: username, password: password)
|
32
|
-
|
33
|
-
subject rescue Exception
|
34
|
-
end
|
35
|
-
|
36
|
-
context "when the server responds with build results" do
|
11
|
+
it_behaves_like "a continuous integration server" do
|
37
12
|
|
38
|
-
|
39
|
-
let(:response_message) { "OK" }
|
40
|
-
let(:latest_build_status) { "FAILED" }
|
41
|
-
let(:response_body) do
|
42
|
-
<<-RESPONSE
|
43
|
-
<builds count="3" href="/httpAuth/app/rest/buildTypes/#{build_name}/builds/" nextHref="/httpAuth/app/rest/buildTypes/#{build_name}/builds/?count=3&start=3">
|
44
|
-
<build id="87735" buildTypeId="#{build_name}" number="2062" status="#{latest_build_status}" state="finished" href="/httpAuth/app/rest/builds/id:87735" webUrl="#{uri}/viewLog.html?buildId=87735&buildTypeId=#{build_name}"/>
|
45
|
-
<build id="87723" buildTypeId="#{build_name}" number="2061" status="SUCCESS" state="finished" href="/httpAuth/app/rest/builds/id:87723" webUrl="#{uri}/viewLog.html?buildId=87723&buildTypeId=#{build_name}"/>
|
46
|
-
<build id="87658" buildTypeId="#{build_name}" number="2060" status="SUCCESS" state="finished" href="/httpAuth/app/rest/builds/id:87658" webUrl="#{uri}/viewLog.html?buildId=87658&buildTypeId=#{build_name}"/>
|
47
|
-
</builds>
|
48
|
-
RESPONSE
|
49
|
-
end
|
13
|
+
let(:server) { team_city_server }
|
50
14
|
|
51
|
-
|
52
|
-
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
53
|
-
|
54
|
-
subject
|
55
|
-
end
|
56
|
-
|
57
|
-
it "creates a build result containing the latest build status" do
|
58
|
-
expect(BuildEval::Result::BuildResult).to(
|
59
|
-
receive(:create).with(hash_including(status_name: latest_build_status))
|
60
|
-
)
|
61
|
-
|
62
|
-
subject
|
63
|
-
end
|
64
|
-
|
65
|
-
it "returns the created result" do
|
66
|
-
build_result = instance_double(BuildEval::Result::BuildResult)
|
67
|
-
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
68
|
-
|
69
|
-
expect(subject).to eql(build_result)
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
context "when the server authentication request fails" do
|
75
|
-
|
76
|
-
let(:response_code) { "401" }
|
77
|
-
let(:response_message) { "Unauthorized" }
|
78
|
-
let(:response_body) { "Incorrect username or password" }
|
15
|
+
end
|
79
16
|
|
80
|
-
|
81
|
-
expect { subject }.to raise_error(/Unauthorized/)
|
82
|
-
end
|
17
|
+
describe "#build_result" do
|
83
18
|
|
19
|
+
let(:build_name) { "some_build_name" }
|
20
|
+
let(:response_body) do
|
21
|
+
<<-RESPONSE
|
22
|
+
<builds count="3" href="/httpAuth/app/rest/buildTypes/#{build_name}/builds/" nextHref="/httpAuth/app/rest/buildTypes/#{build_name}/builds/?count=3&start=3">
|
23
|
+
<build id="87735" buildTypeId="#{build_name}" number="2062" status="SUCCESS" state="finished" href="/httpAuth/app/rest/builds/id:87735" webUrl="#{uri}/viewLog.html?buildId=87735&buildTypeId=#{build_name}"/>
|
24
|
+
</builds>
|
25
|
+
RESPONSE
|
84
26
|
end
|
27
|
+
let(:response) { instance_double(Net::HTTPResponse, body: response_body) }
|
85
28
|
|
86
|
-
|
29
|
+
subject { team_city_server.build_result(build_name) }
|
87
30
|
|
88
|
-
|
89
|
-
let(:response_message) { "Not Found" }
|
90
|
-
let(:response_body) do
|
91
|
-
<<-BODY
|
92
|
-
Error has occurred during request processing (Not Found).
|
93
|
-
Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No build type nor template is found by id '#{build_name}'.
|
94
|
-
BODY
|
95
|
-
end
|
31
|
+
before(:example) { allow(http).to receive(:get).and_return(response) }
|
96
32
|
|
97
|
-
|
98
|
-
|
99
|
-
end
|
33
|
+
it "issues a GET request for the build" do
|
34
|
+
expect(http).to receive(:get).with("#{uri}/httpAuth/app/rest/buildTypes/id:#{build_name}/builds")
|
100
35
|
|
36
|
+
subject
|
101
37
|
end
|
102
38
|
|
103
39
|
end
|
104
40
|
|
105
41
|
describe "#to_s" do
|
106
42
|
|
107
|
-
subject {
|
43
|
+
subject { team_city_server.to_s }
|
108
44
|
|
109
45
|
it "returns a string indicating it is a TeamCity server" do
|
110
46
|
expect(subject).to include("TeamCity")
|
@@ -0,0 +1,53 @@
|
|
1
|
+
describe BuildEval::Server::Travis, "integrating with a response parser", integration: true do
|
2
|
+
include_context "stubbed http interactions"
|
3
|
+
|
4
|
+
let(:username) { "some_username" }
|
5
|
+
|
6
|
+
let(:travis) { described_class.new(username: username) }
|
7
|
+
|
8
|
+
describe "#build_result" do
|
9
|
+
|
10
|
+
let(:build_name) { "some_build_name" }
|
11
|
+
let(:response) { instance_double(Net::HTTPResponse, body: response_body) }
|
12
|
+
|
13
|
+
subject { travis.build_result(build_name) }
|
14
|
+
|
15
|
+
before(:example) { allow(http).to receive(:get).and_return(response) }
|
16
|
+
|
17
|
+
context "when the server responds successfully with build results" do
|
18
|
+
|
19
|
+
let(:latest_build_status) { "Success" }
|
20
|
+
let(:response_body) do
|
21
|
+
<<-RESPONSE
|
22
|
+
<Projects>
|
23
|
+
<Project name="#{username}/#{build_name}" activity="Sleeping" lastBuildStatus="#{latest_build_status}" lastBuildLabel="2" lastBuildTime="2015-08-13T08:31:27.000+0000" webUrl="https://travis-ci.org/#{username}/#{build_name}" />
|
24
|
+
</Projects>
|
25
|
+
RESPONSE
|
26
|
+
end
|
27
|
+
|
28
|
+
it "creates a build result containing the build name" do
|
29
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
30
|
+
|
31
|
+
subject
|
32
|
+
end
|
33
|
+
|
34
|
+
it "creates a build result containing the latest build status" do
|
35
|
+
expect(BuildEval::Result::BuildResult).to(
|
36
|
+
receive(:create).with(hash_including(status_name: latest_build_status))
|
37
|
+
)
|
38
|
+
|
39
|
+
subject
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns the created result" do
|
43
|
+
build_result = instance_double(BuildEval::Result::BuildResult)
|
44
|
+
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
45
|
+
|
46
|
+
expect(subject).to eql(build_result)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -1,83 +1,61 @@
|
|
1
1
|
describe BuildEval::Server::Travis do
|
2
|
+
include_context "stubbed http interactions"
|
2
3
|
|
3
|
-
let(:username)
|
4
|
+
let(:username) { "some_username" }
|
5
|
+
let(:constructor_args) { { username: username } }
|
4
6
|
|
5
|
-
let(:
|
7
|
+
let(:travis_server) { described_class.new(constructor_args) }
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
let(:build_name) { "some_build_name" }
|
10
|
-
let(:response_code) { nil }
|
11
|
-
let(:response_message) { nil }
|
12
|
-
let(:response_body) { nil }
|
13
|
-
let(:response) do
|
14
|
-
instance_double(Net::HTTPResponse, code: response_code, message: response_message, body: response_body)
|
15
|
-
end
|
9
|
+
it_behaves_like "a continuous integration server" do
|
16
10
|
|
17
|
-
|
11
|
+
let(:server) { travis_server }
|
18
12
|
|
19
|
-
|
13
|
+
end
|
20
14
|
|
21
|
-
|
22
|
-
expected_uri = "https://api.travis-ci.org/repositories/#{username}/#{build_name}/cc.xml"
|
23
|
-
expect(BuildEval::Http).to receive(:get).with(expected_uri)
|
15
|
+
describe "#build_result" do
|
24
16
|
|
25
|
-
|
17
|
+
let(:build_name) { "some_build_name" }
|
18
|
+
let(:response) { instance_double(Net::HTTPResponse) }
|
19
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
20
|
+
let(:cruise_control_response) do
|
21
|
+
instance_double(BuildEval::Server::CruiseControlResponse, parse_result: build_result)
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
let(:response_code) { "200" }
|
31
|
-
let(:response_message) { "OK" }
|
32
|
-
let(:latest_build_status) { "Success" }
|
33
|
-
let(:response_body) do
|
34
|
-
<<-RESPONSE
|
35
|
-
<Projects>
|
36
|
-
<Project name="#{username}/#{build_name}" activity="Sleeping" lastBuildStatus="#{latest_build_status}" lastBuildLabel="2" lastBuildTime="2015-08-13T08:31:27.000+0000" webUrl="https://travis-ci.org/#{username}/#{build_name}" />
|
37
|
-
</Projects>
|
38
|
-
RESPONSE
|
39
|
-
end
|
24
|
+
subject { travis_server.build_result(build_name) }
|
40
25
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
it "creates a build result containing the latest build status" do
|
48
|
-
expect(BuildEval::Result::BuildResult).to(
|
49
|
-
receive(:create).with(hash_including(status_name: latest_build_status))
|
50
|
-
)
|
26
|
+
before(:example) do
|
27
|
+
allow(http).to receive(:get).and_return(response)
|
28
|
+
allow(BuildEval::Server::CruiseControlResponse).to receive(:new).and_return(cruise_control_response)
|
29
|
+
allow(cruise_control_response).to receive(:parse_result).and_return(build_result)
|
30
|
+
end
|
51
31
|
|
52
|
-
|
53
|
-
|
32
|
+
it "issues a GET request for the build" do
|
33
|
+
expect(http).to receive(:get).with("https://api.travis-ci.org/repositories/#{username}/#{build_name}/cc.xml")
|
54
34
|
|
55
|
-
|
56
|
-
|
57
|
-
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
35
|
+
subject rescue Exception
|
36
|
+
end
|
58
37
|
|
59
|
-
|
60
|
-
|
38
|
+
it "creates a Cruise Control response containing the GET request response" do
|
39
|
+
expect(BuildEval::Server::CruiseControlResponse).to receive(:new).with(response)
|
61
40
|
|
41
|
+
subject
|
62
42
|
end
|
63
43
|
|
64
|
-
|
65
|
-
|
66
|
-
let(:response_code) { "404" }
|
67
|
-
let(:response_message) { "Not Found" }
|
68
|
-
let(:response_body) { { "file" => "not found" }.to_json }
|
44
|
+
it "parses the Cruise Control response to return the project" do
|
45
|
+
expect(cruise_control_response).to receive(:parse_result).with("//Project")
|
69
46
|
|
70
|
-
|
71
|
-
|
72
|
-
end
|
47
|
+
subject
|
48
|
+
end
|
73
49
|
|
50
|
+
it "returns the parsed build result" do
|
51
|
+
expect(subject).to eql(build_result)
|
74
52
|
end
|
75
53
|
|
76
54
|
end
|
77
55
|
|
78
56
|
describe "#to_s" do
|
79
57
|
|
80
|
-
subject {
|
58
|
+
subject { travis_server.to_s }
|
81
59
|
|
82
60
|
it "returns a string indicating it uses the Travis CI service" do
|
83
61
|
expect(subject).to include("Travis CI")
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe BuildEval, "integrating with a real CI server", smoke: true do
|
2
|
+
|
3
|
+
let(:server) { BuildEval.server(type: :Travis, username: "MYOB-Technology") }
|
4
|
+
|
5
|
+
let(:monitor) { server.monitor("build_eval") }
|
6
|
+
|
7
|
+
describe "the evaluated results from a build monitor for the server" do
|
8
|
+
|
9
|
+
let(:tolerated_statuses) do
|
10
|
+
[ BuildEval::Result::Status::SUCCESS, BuildEval::Result::Status::UNKNOWN, BuildEval::Result::Status::FAILURE ]
|
11
|
+
end
|
12
|
+
|
13
|
+
subject { monitor.evaluate }
|
14
|
+
|
15
|
+
it "indicate the builds status" do
|
16
|
+
expect(tolerated_statuses).to include(subject.status)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "describe the build and it's status" do
|
20
|
+
expect(subject.to_s).to match(/build_eval: (#{tolerated_statuses.map(&:to_s).join("|")})/)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,21 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:development)
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
if ENV["coverage"]
|
5
|
+
CodeClimate::TestReporter.start
|
6
6
|
|
7
|
-
|
7
|
+
SimpleCov.start do
|
8
|
+
coverage_dir "tmp/coverage"
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
add_filter "/spec/"
|
11
|
+
|
12
|
+
minimum_coverage 100
|
13
|
+
refuse_coverage_drop
|
14
|
+
end
|
15
|
+
end
|
12
16
|
|
13
17
|
require_relative '../lib/build_eval'
|
18
|
+
|
19
|
+
%w{ shared_examples shared_context }.each do |file_type|
|
20
|
+
Dir[::File.expand_path("../**/*_#{file_type}.rb", __FILE__)].each { |file| require file }
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build_eval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ueckerman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
76
|
+
version: '3.4'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '3.
|
83
|
+
version: '3.4'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: fakeweb
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0.10'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: codeclimate-test-reporter
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0.4'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.4'
|
112
126
|
description: Evaluates the effective status of continuous integration builds. Useful
|
113
127
|
for subsequent display on information radiators.
|
114
128
|
email: matthew.ueckerman@myob.com
|
@@ -117,6 +131,7 @@ extensions: []
|
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
119
133
|
- "./lib/build_eval.rb"
|
134
|
+
- "./lib/build_eval/error.rb"
|
120
135
|
- "./lib/build_eval/http.rb"
|
121
136
|
- "./lib/build_eval/monitor/base.rb"
|
122
137
|
- "./lib/build_eval/monitor/composite.rb"
|
@@ -125,10 +140,15 @@ files:
|
|
125
140
|
- "./lib/build_eval/result/composite_result.rb"
|
126
141
|
- "./lib/build_eval/result/server_result.rb"
|
127
142
|
- "./lib/build_eval/result/status.rb"
|
143
|
+
- "./lib/build_eval/server/cruise_control_response.rb"
|
128
144
|
- "./lib/build_eval/server/decorator.rb"
|
145
|
+
- "./lib/build_eval/server/invalid_selector_error.rb"
|
146
|
+
- "./lib/build_eval/server/jenkins.rb"
|
129
147
|
- "./lib/build_eval/server/team_city.rb"
|
130
148
|
- "./lib/build_eval/server/travis.rb"
|
131
149
|
- "./lib/build_eval/version.rb"
|
150
|
+
- "./spec/lib/build_eval/error_spec.rb"
|
151
|
+
- "./spec/lib/build_eval/http_shared_context.rb"
|
132
152
|
- "./spec/lib/build_eval/http_spec.rb"
|
133
153
|
- "./spec/lib/build_eval/monitor/base_spec.rb"
|
134
154
|
- "./spec/lib/build_eval/monitor/composite_spec.rb"
|
@@ -137,9 +157,17 @@ files:
|
|
137
157
|
- "./spec/lib/build_eval/result/composite_result_spec.rb"
|
138
158
|
- "./spec/lib/build_eval/result/server_result_spec.rb"
|
139
159
|
- "./spec/lib/build_eval/result/status_spec.rb"
|
160
|
+
- "./spec/lib/build_eval/server/cruise_control_response_spec.rb"
|
140
161
|
- "./spec/lib/build_eval/server/decorator_spec.rb"
|
162
|
+
- "./spec/lib/build_eval/server/invalid_selector_error_spec.rb"
|
163
|
+
- "./spec/lib/build_eval/server/jenkins_integration_spec.rb"
|
164
|
+
- "./spec/lib/build_eval/server/jenkins_spec.rb"
|
165
|
+
- "./spec/lib/build_eval/server/server_shared_examples.rb"
|
166
|
+
- "./spec/lib/build_eval/server/team_city_integration_spec.rb"
|
141
167
|
- "./spec/lib/build_eval/server/team_city_spec.rb"
|
168
|
+
- "./spec/lib/build_eval/server/travis_integration_spec.rb"
|
142
169
|
- "./spec/lib/build_eval/server/travis_spec.rb"
|
170
|
+
- "./spec/lib/build_eval_smoke_spec.rb"
|
143
171
|
- "./spec/lib/build_eval_spec.rb"
|
144
172
|
- "./spec/spec_helper.rb"
|
145
173
|
homepage: http://github.com/MYOB-Technology/build_eval
|
@@ -167,6 +195,8 @@ signing_key:
|
|
167
195
|
specification_version: 4
|
168
196
|
summary: Evaluates the effective status of continuous integration builds
|
169
197
|
test_files:
|
198
|
+
- "./spec/lib/build_eval/error_spec.rb"
|
199
|
+
- "./spec/lib/build_eval/http_shared_context.rb"
|
170
200
|
- "./spec/lib/build_eval/http_spec.rb"
|
171
201
|
- "./spec/lib/build_eval/monitor/base_spec.rb"
|
172
202
|
- "./spec/lib/build_eval/monitor/composite_spec.rb"
|
@@ -175,8 +205,16 @@ test_files:
|
|
175
205
|
- "./spec/lib/build_eval/result/composite_result_spec.rb"
|
176
206
|
- "./spec/lib/build_eval/result/server_result_spec.rb"
|
177
207
|
- "./spec/lib/build_eval/result/status_spec.rb"
|
208
|
+
- "./spec/lib/build_eval/server/cruise_control_response_spec.rb"
|
178
209
|
- "./spec/lib/build_eval/server/decorator_spec.rb"
|
210
|
+
- "./spec/lib/build_eval/server/invalid_selector_error_spec.rb"
|
211
|
+
- "./spec/lib/build_eval/server/jenkins_integration_spec.rb"
|
212
|
+
- "./spec/lib/build_eval/server/jenkins_spec.rb"
|
213
|
+
- "./spec/lib/build_eval/server/server_shared_examples.rb"
|
214
|
+
- "./spec/lib/build_eval/server/team_city_integration_spec.rb"
|
179
215
|
- "./spec/lib/build_eval/server/team_city_spec.rb"
|
216
|
+
- "./spec/lib/build_eval/server/travis_integration_spec.rb"
|
180
217
|
- "./spec/lib/build_eval/server/travis_spec.rb"
|
218
|
+
- "./spec/lib/build_eval_smoke_spec.rb"
|
181
219
|
- "./spec/lib/build_eval_spec.rb"
|
182
220
|
- "./spec/spec_helper.rb"
|