azkaban_scheduler 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: <URL>/manager
6
+ body:
7
+ encoding: ASCII-8BIT
8
+ string: !binary |-
9
+ LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0DQpDb250ZW50LURpc3Bv
10
+ c2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9InNlc3Npb24uaWQiDQoNCmJmODNl
11
+ MTE3LTE3MDUtNGExMy04MGUwLTQzNWE2ZjQxYTkyYQ0KLS0tLS0tLS0tLS0t
12
+ LVJ1YnlNdWx0aXBhcnRQb3N0DQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3Jt
13
+ LWRhdGE7IG5hbWU9ImFqYXgiDQoNCnVwbG9hZA0KLS0tLS0tLS0tLS0tLVJ1
14
+ YnlNdWx0aXBhcnRQb3N0DQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRh
15
+ dGE7IG5hbWU9InByb2plY3QiDQoNCkF6a2FiYW5fU2NoZWR1bGVyX1Rlc3QN
16
+ Ci0tLS0tLS0tLS0tLS1SdWJ5TXVsdGlwYXJ0UG9zdA0KQ29udGVudC1EaXNw
17
+ b3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmaWxlIjsgZmlsZW5hbWU9ImZp
18
+ bGUuemlwIg0KQ29udGVudC1MZW5ndGg6IDE1Mg0KQ29udGVudC1UeXBlOiBh
19
+ cHBsaWNhdGlvbi96aXANCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJp
20
+ bmFyeQ0KDQpQSwMEFAAAAAgA+24vReVaWxgkAAAAKAAAAAkAAABmaXJzdC5q
21
+ b2IrqSxItU3Oz81NzEvhgtK2qckZ+QpKGak5OfkK5flFOSlKXABQSwECNAMU
22
+ AAAACAD7bi9F5VpbGCQAAAAoAAAACQAAAAAAAAABAAAApIEAAAAAZmlyc3Qu
23
+ am9iUEsFBgAAAAABAAEANwAAAEsAAAAAAA0KLS0tLS0tLS0tLS0tLVJ1YnlN
24
+ dWx0aXBhcnRQb3N0LS0NCg0K
25
+ headers:
26
+ Accept:
27
+ - application/json
28
+ User-Agent:
29
+ - Ruby
30
+ Content-Type:
31
+ - multipart/form-data; boundary=-----------RubyMultipartPost
32
+ Content-Length:
33
+ - '693'
34
+ response:
35
+ status:
36
+ code: 200
37
+ message: OK
38
+ headers:
39
+ Server:
40
+ - nginx
41
+ Date:
42
+ - Mon, 15 Sep 2014 17:55:55 GMT
43
+ Content-Type:
44
+ - application/json
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Connection:
48
+ - close
49
+ Vary:
50
+ - Accept-Encoding
51
+ P3p:
52
+ - CP="NOI DSP COR NID ADMa OPTa OUR NOR"
53
+ body:
54
+ encoding: US-ASCII
55
+ string: |-
56
+ {
57
+ "error" : "Installation Failed. Project 'Azkaban_Scheduler_Test' doesn't exist."
58
+ }
59
+ http_version:
60
+ recorded_at: Mon, 15 Sep 2014 17:55:55 GMT
61
+ recorded_with: VCR 2.9.0
@@ -10,8 +10,10 @@ class SessionTest < Minitest::Test
10
10
  end
11
11
 
12
12
  def setup_once
13
- session.remove_all_schedules(@project.name)
14
- session.delete_project(@project.name)
13
+ VCR.use_cassette(__method__) do
14
+ session.remove_all_schedules(@project.name)
15
+ session.delete_project(@project.name)
16
+ end
15
17
  end
16
18
 
17
19
  def test_start
@@ -20,69 +22,90 @@ class SessionTest < Minitest::Test
20
22
 
21
23
  def test_start_with_incorrect_password
22
24
  assert_raises(AzkabanScheduler::AuthenticationError) do
23
- AzkabanScheduler::Session.start(client, 'foo', 'bar')
25
+ VCR.use_cassette(__method__) do
26
+ AzkabanScheduler::Session.start(client, 'foo', 'bar')
27
+ end
24
28
  end
25
29
  end
26
30
 
27
31
  def test_create_and_upload_project
28
- session.create_project(@project)
29
- result = session.upload_project(@project)
30
- assert result['projectId']
31
- assert result['version']
32
- assert_equal result['projectId'], @project.id
33
- assert_equal result['version'], @project.version
34
- assert_equal true, session.delete_project(@project.name)
32
+ VCR.use_cassette(__method__) do
33
+ session.create_project(@project)
34
+ result = session.upload_project(@project)
35
+ assert result['projectId']
36
+ assert result['version']
37
+ assert_equal result['projectId'], @project.id
38
+ assert_equal result['version'], @project.version
39
+ assert_equal true, session.delete_project(@project.name)
40
+ end
35
41
  end
36
42
 
37
43
  def test_post_schedule
38
- session.create_project(@project)
39
- session.upload_project(@project)
40
- flow_name = 'first'
41
- start_time = Time.now
42
- session.post_schedule(@project.id, @project.name, flow_name, start_time,
43
- period: '6h',
44
- failure_emails_override: true,
45
- notifyFailureFirst: true,
46
- failure_emails: ['azkaban-scheduler-test@localhost'])
47
- schedule = session.list_schedules.detect { |item| item['projectname'] == @project.name && item['flowname'] == flow_name }
44
+ schedule = nil
45
+ start_time = Time.parse('2014-09-10 21:35:01 UTC')
46
+ VCR.use_cassette(__method__) do
47
+ begin
48
+ session.create_project(@project)
49
+ session.upload_project(@project)
50
+ flow_name = 'first'
51
+ session.post_schedule(@project.id, @project.name, flow_name, start_time,
52
+ period: '6h',
53
+ failure_emails_override: true,
54
+ notifyFailureFirst: true,
55
+ failure_emails: ['azkaban-scheduler-test@localhost'])
56
+ schedule = session.list_schedules.detect { |item| item['projectname'] == @project.name && item['flowname'] == flow_name }
57
+ ensure
58
+ session.remove_all_schedules(@project.name)
59
+ session.delete_project(@project.name)
60
+ end
61
+ end
48
62
  assert schedule['scheduleid']
49
63
  assert_equal (start_time.to_i - start_time.sec) * 1000, schedule['time']
50
64
  assert_equal 6 * 60 * 60 * 1000, schedule['period']
51
- ensure
52
- session.remove_all_schedules(@project.name)
53
- session.delete_project(@project.name)
54
65
  end
55
66
 
56
67
  def test_create_existing_project
57
- session.create_project(@project)
58
- assert_raises(AzkabanScheduler::ProjectExistsError) do
59
- session.create_project(@project)
68
+ VCR.use_cassette(__method__) do
69
+ begin
70
+ session.create_project(@project)
71
+ assert_raises(AzkabanScheduler::ProjectExistsError) do
72
+ session.create_project(@project)
73
+ end
74
+ ensure
75
+ session.delete_project(@project.name)
76
+ end
60
77
  end
61
- ensure
62
- session.delete_project(@project.name)
63
78
  end
64
79
 
65
80
  def test_create_project_with_invalid_name
66
81
  project = AzkabanScheduler::Project.new('Azkaban Scheduler Test', "description")
67
82
  assert_raises(AzkabanScheduler::InvalidProjectNameError) do
68
- session.create_project(project)
83
+ VCR.use_cassette(__method__) do
84
+ session.create_project(project)
85
+ end
69
86
  end
70
87
  end
71
88
 
72
89
  def test_create_project_with_invalid_name
73
90
  project = AzkabanScheduler::Project.new('Azkaban_Scheduler_Test', "")
74
91
  assert_raises(AzkabanScheduler::ProjectDescriptionEmptyError) do
75
- session.create_project(project)
92
+ VCR.use_cassette(__method__) do
93
+ session.create_project(project)
94
+ end
76
95
  end
77
96
  end
78
97
 
79
98
  def test_upload_missing_project
80
99
  assert_raises(AzkabanScheduler::ProjectNotFoundError) do
81
- session.upload_project(@project)
100
+ VCR.use_cassette(__method__) do
101
+ session.upload_project(@project)
102
+ end
82
103
  end
83
104
  end
84
105
 
85
106
  def test_delete_missing_project
86
- assert_equal false, session.delete_project(@project.name)
107
+ VCR.use_cassette(__method__) do
108
+ assert_equal false, session.delete_project(@project.name)
109
+ end
87
110
  end
88
111
  end
@@ -3,11 +3,33 @@ require 'azkaban_scheduler'
3
3
  require "minitest/autorun"
4
4
  require 'yaml'
5
5
  require 'pathname'
6
+ require 'vcr'
6
7
 
8
+ DEFAULT_CONFIG = {
9
+ 'url' => 'http://localhost:8081',
10
+ 'username' => 'admin',
11
+ 'password' => 'password'
12
+ }
13
+
14
+ def test_config
15
+ @test_config ||= begin
16
+ path = Pathname.new(File.dirname(__FILE__)).join('azkaban.yml')
17
+ path.exist? ? YAML.load(path.read) : DEFAULT_CONFIG
18
+ end
19
+ end
20
+
21
+ VCR.configure do |c|
22
+ c.cassette_library_dir = File.expand_path('../fixtures', __FILE__)
23
+ c.hook_into :webmock
24
+ c.filter_sensitive_data("<HTTP_URL>") { test_config['url'].sub(/\Ahttps?:\/\//, 'http://') }
25
+ test_config.each do |key, value|
26
+ c.filter_sensitive_data("<#{key.upcase}>") { test_config[key] }
27
+ end
28
+ end
7
29
 
8
30
  module SessionTestHelper
9
31
  def config
10
- @@config ||= YAML.load(Pathname.new(File.dirname(__FILE__)).join('azkaban.yml').read)
32
+ test_config
11
33
  end
12
34
 
13
35
  def client
metadata CHANGED
@@ -1,93 +1,144 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azkaban_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Thacker-Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQ8wDQYDVQQDDAZhZG1p
14
+ bnMxFzAVBgoJkiaJk/IsZAEZFgdzaG9waWZ5MRMwEQYKCZImiZPyLGQBGRYDY29t
15
+ MB4XDTE0MDUxNTIwMzM0OFoXDTE1MDUxNTIwMzM0OFowPzEPMA0GA1UEAwwGYWRt
16
+ aW5zMRcwFQYKCZImiZPyLGQBGRYHc2hvcGlmeTETMBEGCgmSJomT8ixkARkWA2Nv
17
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL0/81O3e1vh5smcwp2G
18
+ MpLQ6q0kejQLa65bPYPxdzWA1SYOKyGfw+yR9LdFzsuKpwWzKq6zX35lj1IckWS4
19
+ bNBEQzxmufUxU0XPM02haFB8fOfDJzdXsWte9Ge4IFwahwn68gpMqN+BvxL+KMYz
20
+ Iut9YmN44d4LZdsENEIO5vmybuG2vYDz7R56qB0PA+Q2P2CdhymsBad2DQs69FBo
21
+ uico9V6VMYYctL9lCYdzu9IXrOYNTt88suKIVzzAlHOKeN0Ng5qdztFoTR8sfxDr
22
+ Ydg3KHl5n47wlpgd8R0f/4b5gGxW+v9pyJCgQnLlRu7DedVSvv7+GMtj3g9r3nhJ
23
+ KqECAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFI/o
24
+ maf34HXbUOQsdoLHacEKQgunMB0GA1UdEQQWMBSBEmFkbWluc0BzaG9waWZ5LmNv
25
+ bTAdBgNVHRIEFjAUgRJhZG1pbnNAc2hvcGlmeS5jb20wDQYJKoZIhvcNAQEFBQAD
26
+ ggEBADkK9aj5T0HPExsov4EoMWFnO+G7RQ28C30VAfKxnL2UxG6i4XMHVs6Xi94h
27
+ qXFw1ec9Y2eDUqaolT3bviOk9BB197+A8Vz/k7MC6ci2NE+yDDB7HAC8zU6LAx8Y
28
+ Iqvw7B/PSZ/pz4bUVFlTATif4mi1vO3lidRkdHRtM7UePSn2rUpOi0gtXBP3bLu5
29
+ YjHJN7wx5cugMEyroKITG5gL0Nxtu21qtOlHX4Hc4KdE2JqzCPOsS4zsZGhgwhPs
30
+ fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
31
+ TConQSX2BnZdhIEYW+cKzEC/bLc=
32
+ -----END CERTIFICATE-----
33
+ date: 2014-09-15 00:00:00.000000000 Z
12
34
  dependencies:
13
35
  - !ruby/object:Gem::Dependency
14
36
  name: rubyzip
15
- version_requirements: !ruby/object:Gem::Requirement
37
+ requirement: !ruby/object:Gem::Requirement
16
38
  requirements:
17
- - - ~>
39
+ - - "~>"
18
40
  - !ruby/object:Gem::Version
19
41
  version: '1.1'
20
- requirement: !ruby/object:Gem::Requirement
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
21
45
  requirements:
22
- - - ~>
46
+ - - "~>"
23
47
  - !ruby/object:Gem::Version
24
48
  version: '1.1'
25
- prerelease: false
26
- type: :runtime
27
49
  - !ruby/object:Gem::Dependency
28
50
  name: multipart-post
29
- version_requirements: !ruby/object:Gem::Requirement
51
+ requirement: !ruby/object:Gem::Requirement
30
52
  requirements:
31
- - - ~>
53
+ - - "~>"
32
54
  - !ruby/object:Gem::Version
33
55
  version: '2.0'
34
- requirement: !ruby/object:Gem::Requirement
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
35
59
  requirements:
36
- - - ~>
60
+ - - "~>"
37
61
  - !ruby/object:Gem::Version
38
62
  version: '2.0'
39
- prerelease: false
40
- type: :runtime
41
63
  - !ruby/object:Gem::Dependency
42
64
  name: bundler
43
- version_requirements: !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
44
66
  requirements:
45
- - - ~>
67
+ - - "~>"
46
68
  - !ruby/object:Gem::Version
47
69
  version: '1.6'
48
- requirement: !ruby/object:Gem::Requirement
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
49
73
  requirements:
50
- - - ~>
74
+ - - "~>"
51
75
  - !ruby/object:Gem::Version
52
76
  version: '1.6'
53
- prerelease: false
54
- type: :development
55
77
  - !ruby/object:Gem::Dependency
56
78
  name: rake
57
- version_requirements: !ruby/object:Gem::Requirement
79
+ requirement: !ruby/object:Gem::Requirement
58
80
  requirements:
59
- - - '>='
81
+ - - ">="
60
82
  - !ruby/object:Gem::Version
61
83
  version: '0'
62
- requirement: !ruby/object:Gem::Requirement
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
63
87
  requirements:
64
- - - '>='
88
+ - - ">="
65
89
  - !ruby/object:Gem::Version
66
90
  version: '0'
67
- prerelease: false
68
- type: :development
69
91
  - !ruby/object:Gem::Dependency
70
92
  name: minitest
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '5.4'
98
+ type: :development
99
+ prerelease: false
71
100
  version_requirements: !ruby/object:Gem::Requirement
72
101
  requirements:
73
- - - ~>
102
+ - - "~>"
74
103
  - !ruby/object:Gem::Version
75
104
  version: '5.4'
105
+ - !ruby/object:Gem::Dependency
106
+ name: webmock
76
107
  requirement: !ruby/object:Gem::Requirement
77
108
  requirements:
78
- - - ~>
109
+ - - "~>"
79
110
  - !ruby/object:Gem::Version
80
- version: '5.4'
111
+ version: '1.18'
112
+ type: :development
81
113
  prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.18'
119
+ - !ruby/object:Gem::Dependency
120
+ name: vcr
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '2.9'
82
126
  type: :development
83
- description:
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.9'
133
+ description:
84
134
  email:
85
135
  - Dylan.Smith@shopify.com
86
136
  executables: []
87
137
  extensions: []
88
138
  extra_rdoc_files: []
89
139
  files:
90
- - .gitignore
140
+ - ".gitignore"
141
+ - ".travis.yml"
91
142
  - Gemfile
92
143
  - LICENSE.txt
93
144
  - README.md
@@ -101,32 +152,48 @@ files:
101
152
  - lib/azkaban_scheduler/schedule.rb
102
153
  - lib/azkaban_scheduler/session.rb
103
154
  - lib/azkaban_scheduler/version.rb
155
+ - test/fixtures/setup_once.yml
156
+ - test/fixtures/test_create_and_upload_project.yml
157
+ - test/fixtures/test_create_existing_project.yml
158
+ - test/fixtures/test_create_project_with_invalid_name.yml
159
+ - test/fixtures/test_delete_missing_project.yml
160
+ - test/fixtures/test_post_schedule.yml
161
+ - test/fixtures/test_start_with_incorrect_password.yml
162
+ - test/fixtures/test_upload_missing_project.yml
104
163
  - test/session_test.rb
105
164
  - test/test_helper.rb
106
- homepage: https://github.com/dylanahsmith/azkaban_scheduler
165
+ homepage: https://github.com/Shopify/azkaban-scheduler-ruby
107
166
  licenses:
108
167
  - MIT
109
168
  metadata: {}
110
- post_install_message:
169
+ post_install_message:
111
170
  rdoc_options: []
112
171
  require_paths:
113
172
  - lib
114
173
  required_ruby_version: !ruby/object:Gem::Requirement
115
174
  requirements:
116
- - - '>='
175
+ - - ">="
117
176
  - !ruby/object:Gem::Version
118
177
  version: '0'
119
178
  required_rubygems_version: !ruby/object:Gem::Requirement
120
179
  requirements:
121
- - - '>='
180
+ - - ">="
122
181
  - !ruby/object:Gem::Version
123
182
  version: '0'
124
183
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.1.9
127
- signing_key:
184
+ rubyforge_project:
185
+ rubygems_version: 2.2.2
186
+ signing_key:
128
187
  specification_version: 4
129
188
  summary: Azkaban client that can update the schedule
130
189
  test_files:
190
+ - test/fixtures/setup_once.yml
191
+ - test/fixtures/test_create_and_upload_project.yml
192
+ - test/fixtures/test_create_existing_project.yml
193
+ - test/fixtures/test_create_project_with_invalid_name.yml
194
+ - test/fixtures/test_delete_missing_project.yml
195
+ - test/fixtures/test_post_schedule.yml
196
+ - test/fixtures/test_start_with_incorrect_password.yml
197
+ - test/fixtures/test_upload_missing_project.yml
131
198
  - test/session_test.rb
132
199
  - test/test_helper.rb