nats-async 0.1.2 → 0.1.3
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/version.rb +1 -1
- data/spec/examples_spec.rb +34 -30
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14ba43d9d274e8b3bf2ed955560a480dcc9bf5c6668949b1007db1ebf17f02e8
|
|
4
|
+
data.tar.gz: fb0aa3853cbe25ddc1c61882b3e74031de3e916c6366d4450a7c750d4b27bdb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d95c6affdcd42236c16e1f1264dfb1ef4c9cde64bf90fdfe775fceac5f90924bc3e9126b8590d8683fb369121a294a71e9cf8c901b27520c25e0ea814520ee9
|
|
7
|
+
data.tar.gz: cf6213706289cb5b3b6e97d6b2a1ac94c8d75053d50cf7dc9c746f22bc6ff465cc21207e086f2c17498c00ca83d152d761f9fa01e2ad7a23cdeb6c40fbff0e0a
|
data/lib/version.rb
CHANGED
data/spec/examples_spec.rb
CHANGED
|
@@ -27,7 +27,6 @@ RSpec.describe "example scripts" do
|
|
|
27
27
|
|
|
28
28
|
def project_path = File.expand_path("..", __dir__)
|
|
29
29
|
def server_path = File.join(project_path, "bin", "nats-server")
|
|
30
|
-
def config_path = File.join(project_path, "config", "nats.conf")
|
|
31
30
|
|
|
32
31
|
def free_port
|
|
33
32
|
server = TCPServer.new("127.0.0.1", 0)
|
|
@@ -75,37 +74,42 @@ RSpec.describe "example scripts" do
|
|
|
75
74
|
url = "nats://127.0.0.1:#{port}"
|
|
76
75
|
Tempfile.create(["nats-async-example", ".log"]) do |log|
|
|
77
76
|
log_path = log.path
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
run_example("examples/basic_pub_sub.rb", {"NATS_URL" => url})
|
|
93
|
-
run_example(
|
|
94
|
-
"examples/jetstream_roundtrip.rb",
|
|
95
|
-
{
|
|
96
|
-
"NATS_URL" => url,
|
|
97
|
-
"JS_STREAM" => "spec_stream",
|
|
98
|
-
"JS_SUBJECT" => "spec.subject",
|
|
99
|
-
"JS_CONSUMER" => "spec_consumer",
|
|
100
|
-
"JS_PAYLOAD" => "spec payload"
|
|
101
|
-
}
|
|
77
|
+
Tempfile.create(["nats-async", ".conf"]) do |config|
|
|
78
|
+
config.write("debug: true\ntrace: true\n")
|
|
79
|
+
config.flush
|
|
80
|
+
|
|
81
|
+
Dir.mktmpdir("nats-async-js") do |store_dir|
|
|
82
|
+
server = Process.spawn(
|
|
83
|
+
server_path,
|
|
84
|
+
"-c", config.path,
|
|
85
|
+
"-js",
|
|
86
|
+
"-sd", store_dir,
|
|
87
|
+
"-p", port.to_s,
|
|
88
|
+
out: log,
|
|
89
|
+
err: log,
|
|
90
|
+
chdir: project_path
|
|
102
91
|
)
|
|
103
|
-
|
|
92
|
+
|
|
104
93
|
begin
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
wait_for_server(port, server, log_path)
|
|
95
|
+
run_example("examples/basic_pub_sub.rb", {"NATS_URL" => url})
|
|
96
|
+
run_example(
|
|
97
|
+
"examples/jetstream_roundtrip.rb",
|
|
98
|
+
{
|
|
99
|
+
"NATS_URL" => url,
|
|
100
|
+
"JS_STREAM" => "spec_stream",
|
|
101
|
+
"JS_SUBJECT" => "spec.subject",
|
|
102
|
+
"JS_CONSUMER" => "spec_consumer",
|
|
103
|
+
"JS_PAYLOAD" => "spec payload"
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
ensure
|
|
107
|
+
begin
|
|
108
|
+
Process.kill("TERM", server)
|
|
109
|
+
Process.wait(server)
|
|
110
|
+
rescue Errno::ESRCH, Process::Waiter::Error
|
|
111
|
+
nil
|
|
112
|
+
end
|
|
109
113
|
end
|
|
110
114
|
end
|
|
111
115
|
end
|