oncall 0.2.1 → 0.2.2
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/oncall/core/config.rb +0 -4
- data/lib/oncall/core/reporter.rb +11 -2
- data/lib/oncall/core/wrapper.rb +3 -1
- data/lib/oncall/core.rb +0 -4
- data/lib/oncall/{core → dsl}/assertion.rb +1 -1
- data/lib/oncall/dsl/call.rb +30 -0
- data/lib/oncall/{core → dsl}/group.rb +3 -3
- data/lib/oncall/dsl.rb +3 -0
- data/lib/oncall/version.rb +1 -1
- metadata +19 -6
- data/lib/oncall/core/request.rb +0 -13
- data/lib/oncall/core/scenario.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf6d8c043e6c45dbc145642e1e3c51668e0addb39027b85616a5bfe9fe0754c0
|
4
|
+
data.tar.gz: a0d8057d55beb01d63cb42368927a8b44c6b3145a3dda9fdccf6195fae5d459d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b87c28d86ba180d209cc8af17a8c8703fee8100aae086c9c7385f5c525b11c76d9b2d29e853745b130753cc221b3270d39e6bc68c21cccee5d66c21003e182
|
7
|
+
data.tar.gz: b5bd98e87175f7400cefd1abdea81cc8042523b09300f7b5165fe945bc2bc225749c452dcf7a76ce1e9db29e0239f957dc382e9bf724d17d5509f70ebb569c0e
|
data/lib/oncall/core/config.rb
CHANGED
data/lib/oncall/core/reporter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
1
3
|
module Oncall
|
2
4
|
module Core
|
3
5
|
class Reporter
|
@@ -25,7 +27,14 @@ module Oncall
|
|
25
27
|
def finish
|
26
28
|
puts "\n\n"
|
27
29
|
puts @messages
|
28
|
-
|
30
|
+
|
31
|
+
result = "\n#{@results[:success]} passed, #{@results[:failure]} failed.\n"
|
32
|
+
|
33
|
+
if success?
|
34
|
+
puts result.green
|
35
|
+
else
|
36
|
+
puts result.red
|
37
|
+
end
|
29
38
|
end
|
30
39
|
|
31
40
|
def success?
|
@@ -33,7 +42,7 @@ module Oncall
|
|
33
42
|
end
|
34
43
|
|
35
44
|
def report_empty_group
|
36
|
-
print '
|
45
|
+
print '*'
|
37
46
|
@results[:empty] = @results[:empty] + 1
|
38
47
|
end
|
39
48
|
|
data/lib/oncall/core/wrapper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../dsl'
|
2
|
+
|
1
3
|
module Oncall
|
2
4
|
module Core
|
3
5
|
class Wrapper
|
@@ -6,7 +8,7 @@ module Oncall
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def run(reporter)
|
9
|
-
Oncall::
|
11
|
+
Oncall::DSL::Group.new.instance_eval File.read(@file)
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
data/lib/oncall/core.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
module Oncall
|
2
2
|
module Core
|
3
|
-
require_relative 'core/assertion'
|
4
3
|
require_relative 'core/config'
|
5
|
-
require_relative 'core/group'
|
6
4
|
require_relative 'core/reporter'
|
7
|
-
require_relative 'core/request'
|
8
5
|
require_relative 'core/runner'
|
9
|
-
require_relative 'core/scenario'
|
10
6
|
require_relative 'core/world'
|
11
7
|
require_relative 'core/wrapper'
|
12
8
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Oncall
|
2
|
+
module DSL
|
3
|
+
class Call
|
4
|
+
def initialize
|
5
|
+
@config = Oncall::Core.config
|
6
|
+
@http = Net::HTTP.new(@config.domain, @config.port)
|
7
|
+
@headers = { 'User-Agent' => "oncall/#{Oncall::VERSION}" }
|
8
|
+
end
|
9
|
+
|
10
|
+
def header(hash)
|
11
|
+
hash.each do |key, value|
|
12
|
+
@headers[key] = value
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(path, &block)
|
17
|
+
request = Net::HTTP::Get.new(path)
|
18
|
+
|
19
|
+
@headers.each do |key, value|
|
20
|
+
request[key] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
response = @http.request(request)
|
24
|
+
|
25
|
+
assertion = Oncall::DSL::Assertion.new(response, 'GET', path)
|
26
|
+
assertion.instance_exec(&block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Oncall
|
2
|
-
module
|
2
|
+
module DSL
|
3
3
|
class Group
|
4
4
|
def initialize
|
5
5
|
@reporter = Oncall::Core.reporter
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def group(&block)
|
9
9
|
if block_given?
|
10
|
-
scenario = Oncall::
|
10
|
+
scenario = Oncall::DSL::Call.new
|
11
11
|
scenario.instance_exec &block
|
12
12
|
else
|
13
13
|
@reporter.report_empty_group
|
data/lib/oncall/dsl.rb
CHANGED
data/lib/oncall/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oncall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koen Woortman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: json-schema
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,16 +96,15 @@ files:
|
|
82
96
|
- lib/oncall/commands/run_command.rb
|
83
97
|
- lib/oncall/commands/shell_command.rb
|
84
98
|
- lib/oncall/core.rb
|
85
|
-
- lib/oncall/core/assertion.rb
|
86
99
|
- lib/oncall/core/config.rb
|
87
|
-
- lib/oncall/core/group.rb
|
88
100
|
- lib/oncall/core/reporter.rb
|
89
|
-
- lib/oncall/core/request.rb
|
90
101
|
- lib/oncall/core/runner.rb
|
91
|
-
- lib/oncall/core/scenario.rb
|
92
102
|
- lib/oncall/core/world.rb
|
93
103
|
- lib/oncall/core/wrapper.rb
|
94
104
|
- lib/oncall/dsl.rb
|
105
|
+
- lib/oncall/dsl/assertion.rb
|
106
|
+
- lib/oncall/dsl/call.rb
|
107
|
+
- lib/oncall/dsl/group.rb
|
95
108
|
- lib/oncall/http.rb
|
96
109
|
- lib/oncall/templates/oncall.yml.template
|
97
110
|
- lib/oncall/version.rb
|
data/lib/oncall/core/request.rb
DELETED
data/lib/oncall/core/scenario.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Oncall
|
2
|
-
module Core
|
3
|
-
class Scenario
|
4
|
-
def initialize
|
5
|
-
@config = Oncall::Core.config
|
6
|
-
@http = Net::HTTP.new(@config.domain, @config.port)
|
7
|
-
end
|
8
|
-
|
9
|
-
def get(path, &block)
|
10
|
-
request = Net::HTTP::Get.new(path)
|
11
|
-
response = @http.request(request)
|
12
|
-
|
13
|
-
assertion = Oncall::Core::Assertion.new(response, 'GET', path)
|
14
|
-
assertion.instance_exec(&block)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|