contained_mr 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Gemfile +7 -6
- data/Gemfile.lock +9 -5
- data/{README.rdoc → README.md} +6 -3
- data/VERSION +1 -1
- data/contained_mr.gemspec +37 -17
- data/lib/contained_mr/job.rb +32 -122
- data/lib/contained_mr/job_logic.rb +126 -0
- data/lib/contained_mr/mock/job.rb +111 -0
- data/lib/contained_mr/mock/runner.rb +86 -0
- data/lib/contained_mr/mock/template.rb +62 -0
- data/lib/contained_mr/mock.rb +3 -0
- data/lib/contained_mr/namespace.rb +24 -0
- data/lib/contained_mr/runner.rb +31 -24
- data/lib/contained_mr/runner_logic.rb +38 -0
- data/lib/contained_mr/template.rb +12 -71
- data/lib/contained_mr/template_logic.rb +91 -0
- data/lib/contained_mr.rb +10 -3
- data/test/concerns/job_state_cases.rb +75 -0
- data/test/helper.rb +1 -0
- data/test/test_cleaner.rb +6 -6
- data/test/test_contained_mr.rb +15 -0
- data/test/test_job.rb +36 -47
- data/test/test_job_logic.rb +52 -0
- data/test/test_mock_job.rb +94 -0
- data/test/test_mock_runner.rb +99 -0
- data/test/test_mock_template.rb +39 -0
- data/test/test_runner.rb +21 -6
- data/test/test_runner_logic.rb +51 -0
- data/test/test_template.rb +15 -28
- data/test/test_template_logic.rb +47 -0
- metadata +52 -21
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestTemplateLogic < MiniTest::Test
|
4
|
+
def setup
|
5
|
+
ContainedMr.stubs(:template_class).returns ContainedMr::Mock::Template
|
6
|
+
@template = ContainedMr.new_template 'contained_mrtests', 'hello',
|
7
|
+
StringIO.new(File.binread('testdata/hello.zip'))
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_mapper_dockerfile
|
11
|
+
golden = File.read 'testdata/Dockerfile.hello.mapper'
|
12
|
+
golden.sub! 'contained_mrtests/base.hello', 'mock-template-image-id'
|
13
|
+
assert_equal golden, @template.mapper_dockerfile, 'mapper Dockerfile'
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_reducer_dockerfile
|
17
|
+
golden = File.read 'testdata/Dockerfile.hello.reducer'
|
18
|
+
golden.sub! 'contained_mrtests/base.hello', 'mock-template-image-id'
|
19
|
+
assert_equal golden, @template.reducer_dockerfile, 'reducer Dockerfile'
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_mapper_output_path
|
23
|
+
assert_equal '/usr/mrd/map-output', @template.mapper_output_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_reducer_output_path
|
27
|
+
assert_equal '/usr/mrd/reduce-output', @template.reducer_output_path
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_image_tag
|
31
|
+
assert_equal 'contained_mrtests/base.hello', @template.image_tag
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_mapper_env
|
35
|
+
assert_equal ['ITEM=1', 'ITEMS=3'], @template.mapper_env(1)
|
36
|
+
assert_equal ['ITEM=2', 'ITEMS=3'], @template.mapper_env(2)
|
37
|
+
assert_equal ['ITEM=3', 'ITEMS=3'], @template.mapper_env(3)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_reducer_env
|
41
|
+
assert_equal ['ITEMS=3'], @template.reducer_env
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_read_definition
|
45
|
+
assert_equal 3, @template.item_count
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contained_mr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Costan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -39,115 +39,146 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.6.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.6.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: jeweler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 5.8.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 5.8.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: mocha
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.1.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rdoc
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.0
|
103
|
+
version: 4.2.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.0
|
110
|
+
version: 4.2.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.10.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.10.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: yard
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.8.7.6
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 0.8.7.6
|
125
139
|
description: Plumbing for running mappers and reducers inside Docker containers
|
126
140
|
email: victor@costan.us
|
127
141
|
executables: []
|
128
142
|
extensions: []
|
129
143
|
extra_rdoc_files:
|
130
144
|
- LICENSE
|
131
|
-
- README.
|
145
|
+
- README.md
|
132
146
|
files:
|
133
147
|
- ".document"
|
148
|
+
- ".travis.yml"
|
134
149
|
- Gemfile
|
135
150
|
- Gemfile.lock
|
136
151
|
- LICENSE
|
137
|
-
- README.
|
152
|
+
- README.md
|
138
153
|
- Rakefile
|
139
154
|
- VERSION
|
140
155
|
- contained_mr.gemspec
|
141
156
|
- lib/contained_mr.rb
|
142
157
|
- lib/contained_mr/cleaner.rb
|
143
158
|
- lib/contained_mr/job.rb
|
159
|
+
- lib/contained_mr/job_logic.rb
|
160
|
+
- lib/contained_mr/mock.rb
|
161
|
+
- lib/contained_mr/mock/job.rb
|
162
|
+
- lib/contained_mr/mock/runner.rb
|
163
|
+
- lib/contained_mr/mock/template.rb
|
164
|
+
- lib/contained_mr/namespace.rb
|
144
165
|
- lib/contained_mr/runner.rb
|
166
|
+
- lib/contained_mr/runner_logic.rb
|
145
167
|
- lib/contained_mr/template.rb
|
168
|
+
- lib/contained_mr/template_logic.rb
|
169
|
+
- test/concerns/job_state_cases.rb
|
146
170
|
- test/helper.rb
|
147
171
|
- test/test_cleaner.rb
|
172
|
+
- test/test_contained_mr.rb
|
148
173
|
- test/test_job.rb
|
174
|
+
- test/test_job_logic.rb
|
175
|
+
- test/test_mock_job.rb
|
176
|
+
- test/test_mock_runner.rb
|
177
|
+
- test/test_mock_template.rb
|
149
178
|
- test/test_runner.rb
|
179
|
+
- test/test_runner_logic.rb
|
150
180
|
- test/test_template.rb
|
181
|
+
- test/test_template_logic.rb
|
151
182
|
- testdata/Dockerfile.hello.mapper
|
152
183
|
- testdata/Dockerfile.hello.reducer
|
153
184
|
- testdata/hello/Dockerfile
|