nonnative 1.43.0 → 1.44.0
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +21 -0
- data/lib/nonnative.rb +3 -0
- data/lib/nonnative/before.rb +0 -2
- data/lib/nonnative/cucumber.rb +31 -0
- data/lib/nonnative/not_found_error.rb +6 -0
- data/lib/nonnative/pool.rb +10 -6
- data/lib/nonnative/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2baafe2a724951013706a01a247386b01a6eecde9194f6cefbc04348e787f07
|
4
|
+
data.tar.gz: 99d3a81f1ba4ac6bbc217d0aa48f8d37b11682e6bc18067c07a2e9cf62cd6580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf6dc4e8c8e5e7501c83f05080faba0cda93813ce47cb6b548341114c83f41757228dd0a9c58a2e326c828e7873cb7b85cd121e8ed5eb52ce92a6ebfa636581b
|
7
|
+
data.tar.gz: 831daa9769dcb510ac649010bd430bc74d335e93ce9f1791ebd420b37570735ba7cbb46ddb810310ccc0ed659138526e8b84060117c4e048cf55b9e9e8388298
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
## [1.44.0](https://github.com/alexfalkowski/nonnative/compare/v1.43.0...v1.44.0) (2021-05-01)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* move to reusable steps ([#84](https://github.com/alexfalkowski/nonnative/issues/84)) ([37b6175](https://github.com/alexfalkowski/nonnative/commit/37b6175e920dfb70f3d6f13226240dd045c2db3d))
|
11
|
+
|
5
12
|
## [1.43.0](https://github.com/alexfalkowski/nonnative/compare/v1.42.2...v1.43.0) (2021-04-30)
|
6
13
|
|
7
14
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -505,6 +505,13 @@ server.proxy.close_all # To use close_all.
|
|
505
505
|
server.proxy.reset # To reset it back to a good state.
|
506
506
|
```
|
507
507
|
|
508
|
+
With cucumber:
|
509
|
+
|
510
|
+
```cucumber
|
511
|
+
Given I set the proxy for process 'process_1' to 'close_all'
|
512
|
+
Then And I should reset the proxy for process 'process_1'
|
513
|
+
```
|
514
|
+
|
508
515
|
###### Servers
|
509
516
|
|
510
517
|
Setup it up programmatically:
|
@@ -517,6 +524,13 @@ server.proxy.close_all # To use close_all.
|
|
517
524
|
server.proxy.reset # To reset it back to a good state.
|
518
525
|
```
|
519
526
|
|
527
|
+
With cucumber:
|
528
|
+
|
529
|
+
```cucumber
|
530
|
+
Given I set the proxy for server 'server_1' to 'close_all'
|
531
|
+
Then And I should reset the proxy for server 'server_1'
|
532
|
+
```
|
533
|
+
|
520
534
|
###### Services
|
521
535
|
|
522
536
|
Setup it up programmatically:
|
@@ -529,6 +543,13 @@ service.proxy.close_all # To use close_all.
|
|
529
543
|
service.proxy.reset # To reset it back to a good state.
|
530
544
|
```
|
531
545
|
|
546
|
+
With cucumber:
|
547
|
+
|
548
|
+
```cucumber
|
549
|
+
Given I set the proxy for service 'service_1' to 'close_all'
|
550
|
+
Then And I should reset the proxy for service 'service_1'
|
551
|
+
```
|
552
|
+
|
532
553
|
### Go
|
533
554
|
|
534
555
|
As we love using go as a language for services we have added support to start binaries with defined parameters. This expects that you build your services in the format of `command sub_command --params`
|
data/lib/nonnative.rb
CHANGED
@@ -11,11 +11,13 @@ require 'rest-client'
|
|
11
11
|
require 'puma'
|
12
12
|
require 'puma/server'
|
13
13
|
require 'concurrent'
|
14
|
+
require 'cucumber'
|
14
15
|
|
15
16
|
require 'nonnative/version'
|
16
17
|
require 'nonnative/error'
|
17
18
|
require 'nonnative/start_error'
|
18
19
|
require 'nonnative/stop_error'
|
20
|
+
require 'nonnative/not_found_error'
|
19
21
|
require 'nonnative/timeout'
|
20
22
|
require 'nonnative/port'
|
21
23
|
require 'nonnative/configuration'
|
@@ -44,6 +46,7 @@ require 'nonnative/invalid_data_socket_pair'
|
|
44
46
|
require 'nonnative/socket_pair_factory'
|
45
47
|
require 'nonnative/strategy'
|
46
48
|
require 'nonnative/go_command'
|
49
|
+
require 'nonnative/cucumber'
|
47
50
|
|
48
51
|
module Nonnative
|
49
52
|
class << self
|
data/lib/nonnative/before.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Given('I set the proxy for process {string} to {string}') do |name, operation|
|
4
|
+
server = Nonnative.pool.process_by_name(name)
|
5
|
+
server.proxy.send(operation)
|
6
|
+
end
|
7
|
+
|
8
|
+
Given('I set the proxy for server {string} to {string}') do |name, operation|
|
9
|
+
server = Nonnative.pool.server_by_name(name)
|
10
|
+
server.proxy.send(operation)
|
11
|
+
end
|
12
|
+
|
13
|
+
Given('I set the proxy for service {string} to {string}') do |name, operation|
|
14
|
+
service = Nonnative.pool.service_by_name(name)
|
15
|
+
service.proxy.send(operation)
|
16
|
+
end
|
17
|
+
|
18
|
+
Then('I should reset the proxy for process {string}') do |name|
|
19
|
+
server = Nonnative.pool.process_by_name(name)
|
20
|
+
server.proxy.reset
|
21
|
+
end
|
22
|
+
|
23
|
+
Then('I should reset the proxy for server {string}') do |name|
|
24
|
+
server = Nonnative.pool.server_by_name(name)
|
25
|
+
server.proxy.reset
|
26
|
+
end
|
27
|
+
|
28
|
+
Then('I should reset the proxy for service {string}') do |name|
|
29
|
+
service = Nonnative.pool.service_by_name(name)
|
30
|
+
service.proxy.reset
|
31
|
+
end
|
data/lib/nonnative/pool.rb
CHANGED
@@ -17,24 +17,28 @@ module Nonnative
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def process_by_name(name)
|
20
|
-
|
21
|
-
processes[index].first
|
20
|
+
processes[runner_index(configuration.processes, name)].first
|
22
21
|
end
|
23
22
|
|
24
23
|
def server_by_name(name)
|
25
|
-
|
26
|
-
servers[index].first
|
24
|
+
servers[runner_index(configuration.servers, name)].first
|
27
25
|
end
|
28
26
|
|
29
27
|
def service_by_name(name)
|
30
|
-
|
31
|
-
services[index]
|
28
|
+
services[runner_index(configuration.services, name)]
|
32
29
|
end
|
33
30
|
|
34
31
|
private
|
35
32
|
|
36
33
|
attr_reader :configuration
|
37
34
|
|
35
|
+
def runner_index(runners, name)
|
36
|
+
index = runners.find_index { |s| s.name == name }
|
37
|
+
raise NotFoundError, "Could not find runner with name '#{name}'" if index.nil?
|
38
|
+
|
39
|
+
index
|
40
|
+
end
|
41
|
+
|
38
42
|
def processes
|
39
43
|
@processes ||= configuration.processes.map do |p|
|
40
44
|
[Nonnative::Process.new(p), Nonnative::Port.new(p)]
|
data/lib/nonnative/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonnative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.44.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Falkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- lib/nonnative/configuration_runner.rb
|
266
266
|
- lib/nonnative/configuration_server.rb
|
267
267
|
- lib/nonnative/configuration_service.rb
|
268
|
+
- lib/nonnative/cucumber.rb
|
268
269
|
- lib/nonnative/delay_socket_pair.rb
|
269
270
|
- lib/nonnative/error.rb
|
270
271
|
- lib/nonnative/fault_injection_proxy.rb
|
@@ -275,6 +276,7 @@ files:
|
|
275
276
|
- lib/nonnative/invalid_data_socket_pair.rb
|
276
277
|
- lib/nonnative/manual.rb
|
277
278
|
- lib/nonnative/no_proxy.rb
|
279
|
+
- lib/nonnative/not_found_error.rb
|
278
280
|
- lib/nonnative/observability.rb
|
279
281
|
- lib/nonnative/pool.rb
|
280
282
|
- lib/nonnative/port.rb
|