testcontainers-postgres 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25e023c24e32f22ba240ff88dc76549f0a09613aa68f1c36c531797bfde7ff06
4
- data.tar.gz: f0664ba9fadfca4dac0d16128d520ca822adae889270cc7162730db5ac1bd666
3
+ metadata.gz: 9fa51139e6cf8b5e0788a82e7135912294fcd97a41187b7c23070e33ce96b0b4
4
+ data.tar.gz: 54f5b94f4612768cb390ad2a815bc828ee4c171194341ac3fbe2e765bed0d604
5
5
  SHA512:
6
- metadata.gz: 85ef1679c31fe67156afa4bb324dd0b6b050cd8a4d62bbf044a88753799a995e458dfdc69d5836bdd253d5ceddcfce022b57c86e9e2c4f68975636a04de86aff
7
- data.tar.gz: 78ce60e49c0a6d680fd13061fe008b7737ff437b6709399f578dd6c8a3f63ea13238dbab38f07e6b9517fdf0d4f17437426b0f66378c6b5809d09bb0afe4dc07
6
+ metadata.gz: 4dca70a42fe9bc958b83c586041dd3af1efcd0d09c2bfe38da8efc75b27197f9843c62cd6092e169b5aca8ee1cc844d514f02d289b043c45d6a6816a8831a7f5
7
+ data.tar.gz: 5b39f565609eec88957906b4a3754f363f187be0425ec79a7c883ece941cc89e89fc38a4c8a3c3ca8edb345dd2f7e43e6a02cb56a0414731f836d501ca2e25be
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.1.1] - 2023-6-10
2
+
3
+ ### Added
4
+
5
+ - Add healthcheck support on start
6
+
7
+ ### Fixed
8
+
9
+ - Remove support for custom ports, it is not supported by underlying
10
+ images.
11
+
1
12
  ## [0.1.0] - 2023-05-13
2
13
 
3
14
  ### Added
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: ../core
3
3
  specs:
4
- testcontainers-core (0.1.2)
4
+ testcontainers-core (0.1.3)
5
5
  docker-api (~> 2.2)
6
6
 
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- testcontainers-postgres (0.1.0)
11
- testcontainers-core (~> 0.1.1)
10
+ testcontainers-postgres (0.1.1)
11
+ testcontainers-core (~> 0.1.3)
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -137,7 +137,7 @@ end
137
137
 
138
138
  ## Contributing
139
139
 
140
- Bug reports and pull requests are welcome on GitHub at https://github.com/guilleiguaran/testcontainers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/guilleiguaran/testcontainers-ruby/blob/main/CODE_OF_CONDUCT.md).
140
+ Bug reports and pull requests are welcome on GitHub at https://github.com/testcontainers/testcontainers-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/testcontainers/testcontainers-ruby/blob/main/CODE_OF_CONDUCT.md).
141
141
 
142
142
  ## License
143
143
 
@@ -145,4 +145,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
145
145
 
146
146
  ## Code of Conduct
147
147
 
148
- Everyone interacting in the Testcontainers project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/guilleiguaran/testcontainers-ruby/blob/main/CODE_OF_CONDUCT.md).
148
+ Everyone interacting in the Testcontainers project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/testcontainers/testcontainers-ruby/blob/main/CODE_OF_CONDUCT.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Testcontainers
4
4
  module Postgres
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
@@ -5,7 +5,6 @@ require "uri"
5
5
  module Testcontainers
6
6
  # PostgresContainer class is used to manage containers that runs a PostgresQL database
7
7
  #
8
- # @attr_reader [String] port used by the container
9
8
  # @attr_reader [String] username used by the container
10
9
  # @attr_reader [String] password used by the container
11
10
  # @attr_reader [String] database used by the container
@@ -20,7 +19,7 @@ module Testcontainers
20
19
  POSTGRES_DEFAULT_PASSWORD = "test"
21
20
  POSTGRES_DEFAULT_DATABASE = "test"
22
21
 
23
- attr_reader :port, :username, :password, :database
22
+ attr_reader :username, :password, :database
24
23
 
25
24
  # Initializes a new instance of PostgresContainer
26
25
  #
@@ -33,21 +32,29 @@ module Testcontainers
33
32
  # @return [PostgresContainer] a new instance of PostgresContainer
34
33
  def initialize(image = POSTGRES_DEFAULT_IMAGE, username: nil, password: nil, database: nil, port: nil, **kwargs)
35
34
  super(image, **kwargs)
36
- @port = port || ENV.fetch("POSTGRES_PORT", POSTGRES_DEFAULT_PORT)
37
35
  @username = username || ENV.fetch("POSTGRES_USER", POSTGRES_DEFAULT_USERNAME)
38
36
  @password = password || ENV.fetch("POSTGRES_PASSWORD", POSTGRES_DEFAULT_PASSWORD)
39
37
  @database = database || ENV.fetch("POSTGRES_DATABASE", POSTGRES_DEFAULT_DATABASE)
38
+ @healthcheck ||= add_healthcheck(_default_healthcheck_options)
39
+ @wait_for ||= add_wait_for(:healthcheck)
40
40
  end
41
41
 
42
42
  # Starts the container
43
43
  #
44
44
  # @return [PostgresContainer] self
45
45
  def start
46
- with_exposed_ports(@port)
46
+ with_exposed_ports(port)
47
47
  _configure
48
48
  super
49
49
  end
50
50
 
51
+ # Returns the port used by the container
52
+ #
53
+ # @return [Integer] the port used by the container
54
+ def port
55
+ POSTGRES_DEFAULT_PORT
56
+ end
57
+
51
58
  # Returns the database url (e.g. postgres://user:password@host:port/database)
52
59
  #
53
60
  # @param protocol [String] the protocol to use in the string (default: "postgres")
@@ -103,5 +110,9 @@ module Testcontainers
103
110
  add_env("POSTGRES_PASSWORD", @password)
104
111
  add_env("POSTGRES_ROOT_PASSWORD", @password)
105
112
  end
113
+
114
+ def _default_healthcheck_options
115
+ {test: ["psql", "--port=#{port}", "--user=#{username}", "--dbname=#{database}", "--quiet", "-c", "\\l"], interval: 1, timeout: 5, retries: 5}
116
+ end
106
117
  end
107
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcontainers-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Piza
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-05-13 00:00:00.000000000 Z
12
+ date: 2023-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: testcontainers-core
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.1.2
20
+ version: 0.1.3
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.1.2
27
+ version: 0.1.3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -112,13 +112,13 @@ files:
112
112
  - Rakefile
113
113
  - lib/testcontainers/postgres.rb
114
114
  - lib/testcontainers/postgres/version.rb
115
- homepage: https://github.com/guilleiguaran/testcontainers-ruby
115
+ homepage: https://github.com/testcontainers/testcontainers-ruby
116
116
  licenses:
117
117
  - MIT
118
118
  metadata:
119
- homepage_uri: https://github.com/guilleiguaran/testcontainers-ruby/blob/main/postgres
120
- source_code_uri: https://github.com/guilleiguaran/testcontainers-ruby/blob/main/postgres
121
- changelog_uri: https://github.com/guilleiguaran/testcontainers-ruby/blob/main/postgres/CHANGELOG.md
119
+ homepage_uri: https://github.com/testcontainers/testcontainers-ruby/blob/main/postgres
120
+ source_code_uri: https://github.com/testcontainers/testcontainers-ruby/blob/main/postgres
121
+ changelog_uri: https://github.com/testcontainers/testcontainers-ruby/blob/main/postgres/CHANGELOG.md
122
122
  post_install_message:
123
123
  rdoc_options: []
124
124
  require_paths: