bake-test-integration 0.0.1
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/bake/test/integration.rb +20 -0
- data/lib/bake/test/integration/controller.rb +85 -0
- data/lib/bake/test/integration/version.rb +15 -0
- data/lib/bake/test/integration.rb +14 -0
- data/license.md +21 -0
- data/readme.md +51 -0
- data/releases.md +3 -0
- data.tar.gz.sig +0 -0
- metadata +92 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f81585908b8cee3c9caf1a41ff1c944e9e19250e3a044e648fbec058220afaf6
|
|
4
|
+
data.tar.gz: c01cd3b5d724623f573d46f317cc6d8a22982501c3dd4fdba4aaf11093d6aadb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b67727a28892ed2212f28376bcf9f66ffc6b13ce463cb39989679c4db853915d300e70950c8c1f7debe278f81ab40a7a7c77e647ac336fcdd6f3307592c45351
|
|
7
|
+
data.tar.gz: cc81c1f01a2ff93d0a0e65df00cb9ec0f4949a6272bdeb17830cba1183afc1130dc6bc790e65c3a6fbe8c0ac971d94451c71c531e05f0be0dd99472ea11f317a
|
checksums.yaml.gz.sig
ADDED
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
def initialize(context)
|
|
7
|
+
super
|
|
8
|
+
|
|
9
|
+
require "bake/test/integration"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Run Docker Compose integration test scenarios.
|
|
13
|
+
# @parameter name [String | Nil] The scenario name, or all scenarios when omitted.
|
|
14
|
+
# @parameter path [String] The directory containing integration test scenarios.
|
|
15
|
+
# @parameter service [String] The service whose exit status determines the result.
|
|
16
|
+
# @parameter build [Boolean] Whether Compose should build images before running tests.
|
|
17
|
+
def integration(name: nil, path: "integration", service: "tests", build: true)
|
|
18
|
+
controller = Bake::Test::Integration::Controller.new(context.root)
|
|
19
|
+
controller.run(name: name, path: path, service: service, build: build)
|
|
20
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require "pathname"
|
|
7
|
+
|
|
8
|
+
module Bake
|
|
9
|
+
module Test
|
|
10
|
+
module Integration
|
|
11
|
+
# Runs Docker Compose integration test scenarios.
|
|
12
|
+
class Controller
|
|
13
|
+
COMPOSE_FILE = "docker-compose.yaml"
|
|
14
|
+
DEFAULT_COMMAND = ["docker", "compose"].freeze
|
|
15
|
+
|
|
16
|
+
# Initialize a controller for the given project root.
|
|
17
|
+
# @parameter root [String | Pathname] The project root.
|
|
18
|
+
# @parameter command [Array(String)] The Docker Compose command.
|
|
19
|
+
# @parameter runner [Interface(:call)] The command runner.
|
|
20
|
+
def initialize(root = Dir.pwd, command: DEFAULT_COMMAND, runner: Kernel.method(:system))
|
|
21
|
+
@root = Pathname.new(root)
|
|
22
|
+
@command = command
|
|
23
|
+
@runner = runner
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Enumerate integration test scenario directories in deterministic order.
|
|
27
|
+
# @parameter path [String] The directory containing integration test scenarios.
|
|
28
|
+
# @returns [Array(Pathname)] The discovered scenario directories.
|
|
29
|
+
def scenarios(path: "integration")
|
|
30
|
+
@root.join(path).glob("*/#{COMPOSE_FILE}").sort.map(&:dirname)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Run one or all integration test scenarios.
|
|
34
|
+
# @parameter name [String | Nil] The scenario name, or all scenarios when omitted.
|
|
35
|
+
# @parameter path [String] The directory containing integration test scenarios.
|
|
36
|
+
# @parameter service [String] The service whose exit status determines the result.
|
|
37
|
+
# @parameter build [Boolean] Whether Compose should build images before running tests.
|
|
38
|
+
# @raises [ArgumentError] If no matching scenarios exist.
|
|
39
|
+
def run(name: nil, path: "integration", service: "tests", build: true)
|
|
40
|
+
scenarios = self.scenarios(path: path)
|
|
41
|
+
|
|
42
|
+
if name
|
|
43
|
+
scenarios.select!{|scenario| scenario.basename.to_s == name.to_s}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if scenarios.empty?
|
|
47
|
+
raise ArgumentError, "No integration test scenarios found#{" for #{name.inspect}" if name}!"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
scenarios.each do |scenario|
|
|
51
|
+
run_scenario(scenario, service: service, build: build)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def run_scenario(scenario, service:, build:)
|
|
58
|
+
command = [*@command, "up"]
|
|
59
|
+
command << "--build" if build
|
|
60
|
+
command.concat(["--exit-code-from", service])
|
|
61
|
+
|
|
62
|
+
succeeded = false
|
|
63
|
+
|
|
64
|
+
begin
|
|
65
|
+
execute(*command, chdir: scenario)
|
|
66
|
+
succeeded = true
|
|
67
|
+
ensure
|
|
68
|
+
teardown = [*@command, "down", "--volumes", "--remove-orphans"]
|
|
69
|
+
teardown_succeeded = @runner.call(*teardown, chdir: scenario.to_s)
|
|
70
|
+
|
|
71
|
+
if succeeded && !teardown_succeeded
|
|
72
|
+
raise "Command failed: #{teardown.join(" ")}"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def execute(*command, chdir:)
|
|
78
|
+
unless @runner.call(*command, chdir: chdir.to_s)
|
|
79
|
+
raise "Command failed: #{command.join(" ")}"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require_relative "integration/version"
|
|
7
|
+
require_relative "integration/controller"
|
|
8
|
+
|
|
9
|
+
module Bake
|
|
10
|
+
module Test
|
|
11
|
+
module Integration
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright, 2026, by Samuel Williams.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Bake Test Integration
|
|
2
|
+
|
|
3
|
+
A Bake extension for running Docker Compose integration test scenarios consistently.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/socketry/bake-test-integration/actions?workflow=Test)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Please see the [project documentation](https://socketry.github.io/bake-test-integration/) for more details.
|
|
10
|
+
|
|
11
|
+
- [Getting Started](https://socketry.github.io/bake-test-integration/guides/getting-started/index) - This guide explains how to run Docker Compose integration test scenarios consistently with `bake-test-integration`.
|
|
12
|
+
|
|
13
|
+
## Releases
|
|
14
|
+
|
|
15
|
+
Please see the [project releases](https://socketry.github.io/bake-test-integration/releases/index) for all releases.
|
|
16
|
+
|
|
17
|
+
### v0.0.1
|
|
18
|
+
|
|
19
|
+
## Contributing
|
|
20
|
+
|
|
21
|
+
We welcome contributions to this project.
|
|
22
|
+
|
|
23
|
+
1. Fork the repository.
|
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
|
25
|
+
3. Commit your changes (`git commit -am 'Add some feature.'`).
|
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
|
27
|
+
5. Create a new pull request.
|
|
28
|
+
|
|
29
|
+
### Running Tests
|
|
30
|
+
|
|
31
|
+
To run the test suite:
|
|
32
|
+
|
|
33
|
+
``` shell
|
|
34
|
+
bundle exec sus
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Making Releases
|
|
38
|
+
|
|
39
|
+
To make a new release:
|
|
40
|
+
|
|
41
|
+
``` shell
|
|
42
|
+
bundle exec bake gem:release:patch # or minor or major
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Developer Certificate of Origin
|
|
46
|
+
|
|
47
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
|
48
|
+
|
|
49
|
+
### Community Guidelines
|
|
50
|
+
|
|
51
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data/releases.md
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bake-test-integration
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Samuel Williams
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain:
|
|
10
|
+
- |
|
|
11
|
+
-----BEGIN CERTIFICATE-----
|
|
12
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
|
13
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
|
14
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
|
15
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
|
16
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
|
17
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
|
18
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
|
19
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
|
20
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo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CP
|
|
35
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
|
36
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
37
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
38
|
+
-----END CERTIFICATE-----
|
|
39
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
40
|
+
dependencies:
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
executables: []
|
|
56
|
+
extensions: []
|
|
57
|
+
extra_rdoc_files: []
|
|
58
|
+
files:
|
|
59
|
+
- bake/test/integration.rb
|
|
60
|
+
- lib/bake/test/integration.rb
|
|
61
|
+
- lib/bake/test/integration/controller.rb
|
|
62
|
+
- lib/bake/test/integration/version.rb
|
|
63
|
+
- license.md
|
|
64
|
+
- readme.md
|
|
65
|
+
- releases.md
|
|
66
|
+
homepage: https://github.com/socketry/bake-test-integration
|
|
67
|
+
licenses:
|
|
68
|
+
- MIT
|
|
69
|
+
metadata:
|
|
70
|
+
bug_tracker_uri: https://github.com/socketry/bake-test-integration/issues
|
|
71
|
+
changelog_uri: https://github.com/socketry/bake-test-integration/blob/main/releases.md
|
|
72
|
+
documentation_uri: https://socketry.github.io/bake-test-integration/
|
|
73
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
|
74
|
+
source_code_uri: https://github.com/socketry/bake-test-integration.git
|
|
75
|
+
rdoc_options: []
|
|
76
|
+
require_paths:
|
|
77
|
+
- lib
|
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.3'
|
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
requirements: []
|
|
89
|
+
rubygems_version: 4.0.10
|
|
90
|
+
specification_version: 4
|
|
91
|
+
summary: Run integration test suites consistently.
|
|
92
|
+
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|