fluent-plugin-sql 2.3.0 → 2.3.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: 88024ff651d07318ed1d0abf03a0c43601e61288356544c53805a7678e6e5c45
4
- data.tar.gz: 020b0a879adfa39a5130105e9c75ed1d3e65574de63624a52f698c91b3e48d48
3
+ metadata.gz: faedf22555693658bbb43e81ed55ec147f00196e883b2f53fe42cb3617860440
4
+ data.tar.gz: df4fa7f20a2bc8e779b6ed1fc80f42b70bc2be1e2e990c0ac9c9916a2ec02570
5
5
  SHA512:
6
- metadata.gz: c258a8f2b9eb8dbc78cfe1709cfcee97b647d1ab4067bc1e47624dc296ea3196b313b0d7fd2543f37cdbd67598b846507a1ee0f705d1d9e338098bd3977e28e9
7
- data.tar.gz: a32904e86a3d30a586e745a60fb48f4e43a78e427a32ea81beba225dba858c7aff9a3afb85e1ce5d7325daea1505a200845d38d330cadd0c47f8e85edab7a26c
6
+ metadata.gz: e5176135b712ac70afb866fe5f5139ddbc49f76c0180e28ed8a5cb37be5b109d0639a2b62963c0586119f6b0f55c78eb59501cb459af2afae9c1ee9a57edba15
7
+ data.tar.gz: e6644d47e0115f3030d42e089dbce1e70e964dc6b3c549e6f69a8aad18962ad4592685224de28554a4be1e1e6bb4da6917e06f496ab981eea735983755c39464
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -0,0 +1,45 @@
1
+ name: Test with Ruby head
2
+ on:
3
+ schedule:
4
+ - cron: '11 23 * * 0'
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby: [ 'head' ]
14
+ postgres: [ '16', '15', '14', '13', '12' ]
15
+ os:
16
+ - ubuntu-latest
17
+ services:
18
+ postgres:
19
+ image: postgres:${{ matrix.postgres }}
20
+ ports:
21
+ - 5432:5432
22
+ env:
23
+ POSTGRES_USER: postgres
24
+ POSTGRES_PASSWORD: password
25
+ POSTGRES_DB: test
26
+ options: >-
27
+ --health-cmd pg_isready
28
+ --health-interval 10s
29
+ --health-timeout 5s
30
+ --health-retries 5
31
+ name: Ruby ${{ matrix.ruby }} with PostgreSQL ${{ matrix.postgres }} unit testing on ${{ matrix.os }}
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
38
+ - name: prepare database
39
+ env:
40
+ PGPASSWORD: password
41
+ run: |
42
+ psql -h localhost -p 5432 -U postgres -c "CREATE ROLE fluentd WITH LOGIN ENCRYPTED PASSWORD 'fluentd';"
43
+ psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE fluentd_test OWNER fluentd;"
44
+ - name: unit testing
45
+ run: bundle exec rake test
@@ -1,41 +1,20 @@
1
- name: linux
1
+ name: Test
2
2
  on:
3
- - push
4
- - pull_request
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+ branches: [master]
5
7
 
6
8
  jobs:
7
9
  build:
8
10
  runs-on: ${{ matrix.os }}
9
- continue-on-error: ${{ matrix.experimental }}
10
11
  strategy:
11
12
  fail-fast: false
12
13
  matrix:
13
- ruby: [ '2.5', '2.6', '2.7', '3.0' ]
14
- postgres: [ '9', '10', '11', '12', '13' ]
14
+ ruby: [ '3.3', '3.2', '3.1', '3.0', '2.7' ]
15
+ postgres: [ '16', '15', '14', '13', '12' ]
15
16
  os:
16
17
  - ubuntu-latest
17
- experimental: [false]
18
- include:
19
- - ruby: head
20
- postgres: '9'
21
- os: ubuntu-latest
22
- experimental: true
23
- - ruby: head
24
- postgres: '10'
25
- os: ubuntu-latest
26
- experimental: true
27
- - ruby: head
28
- postgres: '11'
29
- os: ubuntu-latest
30
- experimental: true
31
- - ruby: head
32
- postgres: '12'
33
- os: ubuntu-latest
34
- experimental: true
35
- - ruby: head
36
- postgres: '13'
37
- os: ubuntu-latest
38
- experimental: true
39
18
  services:
40
19
  postgres:
41
20
  image: postgres:${{ matrix.postgres }}
@@ -52,10 +31,11 @@ jobs:
52
31
  --health-retries 5
53
32
  name: Ruby ${{ matrix.ruby }} with PostgreSQL ${{ matrix.postgres }} unit testing on ${{ matrix.os }}
54
33
  steps:
55
- - uses: actions/checkout@v2
34
+ - uses: actions/checkout@v4
56
35
  - uses: ruby/setup-ruby@v1
57
36
  with:
58
37
  ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
59
39
  - name: prepare database
60
40
  env:
61
41
  PGPASSWORD: password
@@ -63,7 +43,4 @@ jobs:
63
43
  psql -h localhost -p 5432 -U postgres -c "CREATE ROLE fluentd WITH LOGIN ENCRYPTED PASSWORD 'fluentd';"
64
44
  psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE fluentd_test OWNER fluentd;"
65
45
  - name: unit testing
66
- run: |
67
- gem install bundler rake
68
- bundle install --jobs 4 --retry 3
69
- bundle exec rake test
46
+ run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ pkg/*
3
+ .vscode
4
+ .idea/
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Release 2.3.1 - 2024/02/29
2
+
3
+  * in_sql: Fix incompatibility against Ruby 3.2
4
+
1
5
  Release 2.3.0 - 2021/10/08
2
6
 
3
7
   * in_sql: Make table time_format configurable
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -282,7 +282,7 @@ module Fluent::Plugin
282
282
  require 'yaml'
283
283
 
284
284
  @path = path
285
- if File.exists?(@path)
285
+ if File.exist?(@path)
286
286
  @data = YAML.load_file(@path)
287
287
  if @data == false || @data == []
288
288
  # this happens if an users created an empty file accidentally
data/test/helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "test/unit"
2
2
  require "test/unit/rr"
3
- require "test/unit/notify"
3
+ require "test/unit/notify" unless ENV['CI']
4
4
  require "fluent/test"
5
5
  require "fluent/plugin/out_sql"
6
6
  require "fluent/plugin/in_sql"
@@ -0,0 +1,96 @@
1
+ require "helper"
2
+ require "fluent/test/driver/input"
3
+
4
+ class SqlInputStateFileTest < Test::Unit::TestCase
5
+ def setup
6
+ Fluent::Test.setup
7
+ end
8
+
9
+ def teardown
10
+ end
11
+
12
+ CONFIG = %[
13
+ adapter postgresql
14
+ host localhost
15
+ port 5432
16
+ database fluentd_test
17
+
18
+ username fluentd
19
+ password fluentd
20
+
21
+ state_file /tmp/sql_state
22
+
23
+ schema_search_path public
24
+
25
+ tag_prefix db
26
+
27
+ <table>
28
+ table messages
29
+ tag logs
30
+ update_column updated_at
31
+ time_column updated_at
32
+ </table>
33
+ ]
34
+
35
+ def create_driver(conf = CONFIG)
36
+ Fluent::Test::Driver::Input.new(Fluent::Plugin::SQLInput).configure(conf)
37
+ end
38
+
39
+ def test_configure
40
+ d = create_driver
41
+ expected = {
42
+ host: "localhost",
43
+ port: 5432,
44
+ adapter: "postgresql",
45
+ database: "fluentd_test",
46
+ username: "fluentd",
47
+ password: "fluentd",
48
+ schema_search_path: "public",
49
+ tag_prefix: "db"
50
+ }
51
+ actual = {
52
+ host: d.instance.host,
53
+ port: d.instance.port,
54
+ adapter: d.instance.adapter,
55
+ database: d.instance.database,
56
+ username: d.instance.username,
57
+ password: d.instance.password,
58
+ schema_search_path: d.instance.schema_search_path,
59
+ tag_prefix: d.instance.tag_prefix
60
+ }
61
+ assert_equal(expected, actual)
62
+ tables = d.instance.instance_variable_get(:@tables)
63
+ assert_equal(1, tables.size)
64
+ messages = tables.first
65
+ assert_equal("messages", messages.table)
66
+ assert_equal("logs", messages.tag)
67
+ end
68
+
69
+ def test_message
70
+ d = create_driver(CONFIG + "select_interval 1")
71
+ Message.create!(message: "message 1")
72
+ Message.create!(message: "message 2")
73
+ Message.create!(message: "message 3")
74
+
75
+ d.end_if do
76
+ d.record_count >= 3
77
+ end
78
+ d.run
79
+
80
+ assert_equal("db.logs", d.events[0][0])
81
+ expected = [
82
+ [d.events[0][1], "message 1"],
83
+ [d.events[1][1], "message 2"],
84
+ [d.events[2][1], "message 3"],
85
+ ]
86
+ actual = [
87
+ [Fluent::EventTime.parse(d.events[0][2]["updated_at"]), d.events[0][2]["message"]],
88
+ [Fluent::EventTime.parse(d.events[1][2]["updated_at"]), d.events[1][2]["message"]],
89
+ [Fluent::EventTime.parse(d.events[2][2]["updated_at"]), d.events[2][2]["message"]],
90
+ ]
91
+ assert_equal(expected, actual)
92
+ end
93
+
94
+ class Message < ActiveRecord::Base
95
+ end
96
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-08 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -134,7 +134,10 @@ executables: []
134
134
  extensions: []
135
135
  extra_rdoc_files: []
136
136
  files:
137
+ - ".github/dependabot.yml"
138
+ - ".github/workflows/linux-ruby-head.yml"
137
139
  - ".github/workflows/linux.yml"
140
+ - ".gitignore"
138
141
  - ChangeLog
139
142
  - Gemfile
140
143
  - Gemfile.v0.12
@@ -148,6 +151,7 @@ files:
148
151
  - test/helper.rb
149
152
  - test/plugin/test_in_sql.rb
150
153
  - test/plugin/test_in_sql_with_custom_time.rb
154
+ - test/plugin/test_in_sql_with_state_file.rb
151
155
  - test/plugin/test_out_sql.rb
152
156
  homepage: https://github.com/fluent/fluent-plugin-sql
153
157
  licenses: