mumuki-gobstones-runner 1.10.2 → 1.11.0

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: a25c116e5577d9a6ec6bd39ea1c385f5f6cbfbd11348aa5d5a3c4370536d6c99
4
- data.tar.gz: 2b7b816e3347a90bdcd49d5273d7eb3d53e5e6a0f101b591951cf8d21a038cea
3
+ metadata.gz: 3199fbffe852edccab69f24303b07c4d177902f5fbcc60e8440c88dbd8f7b25c
4
+ data.tar.gz: c105259943ecac7f90d24a1a7e4dc775546247b795bafc68fd5f64934b6e39e6
5
5
  SHA512:
6
- metadata.gz: ccb9d74307dd8e4e7a0a92ccfd984ddf5c8815f4ff1e6cbf0c05fa952fc48a21216c1d6dabccfd300f592fe4a9f6f6ca3c6d144e9e9382fbd7e6aa7dcfdf00df
7
- data.tar.gz: 7d0909dd929f4812c02e45c761d70f3d5a2422bc47da3203335422817557355b5907bfeb3eaea93e4e67e03b31147c05e2cf3d0726a148a0304c48acc95901ee
6
+ metadata.gz: 7005215585bd9fbc9427edc5b4e24ae7164e8e42a45d8b260324f047bf0871e7c8f047cd3c0aaeb64414d515ac75c535bd6a1aad4ec1257958f60a112db74673
7
+ data.tar.gz: d7b6921fdbbb445704febd35d6711dbd900cecc4ed7d2d6c03e05feca5bb9e1ef4ed0a9fe8e0877b2210b3b1a0448512bba29cf849d3058a6dbbdd4b8c6124a6
data/lib/assets_server.rb CHANGED
@@ -31,9 +31,9 @@ class Mumukit::Server::App < Sinatra::Base
31
31
  get_asset route, File.join(__dir__, '..', path), type
32
32
  end
33
33
 
34
- get_board_asset 'polymer.html', 'htmls/vendor/polymer.html', 'text/html'
35
- get_board_asset 'polymer-mini.html', 'htmls/vendor/polymer-mini.html', 'text/html'
36
- get_board_asset 'polymer-micro.html', 'htmls/vendor/polymer-micro.html', 'text/html'
34
+ ['polymer', 'polymer-mini', 'polymer-micro'].each { |name|
35
+ get_board_asset "#{name}.html", "htmls/vendor/#{name}.html", 'text/html'
36
+ }
37
37
  get_board_asset 'gs-board.html', 'htmls/gs-board.html', 'text/html'
38
38
 
39
39
  get_editor_asset 'editor/gs-element-blockly.html', 'htmls/gs-element-blockly.html', 'text/html'
@@ -44,6 +44,7 @@ class Mumukit::Server::App < Sinatra::Base
44
44
  get_local_asset 'editor/editor.css', 'lib/render/editor/editor.css', 'text/css'
45
45
  get_local_asset 'editor/editor.html', 'lib/render/editor/editor.html', 'text/html'
46
46
  get_local_asset 'boom.png', 'lib/public/boom.png', 'image/png'
47
- get_local_asset 'editor/attires_enabled.svg', 'lib/public/attires_enabled.svg', 'image/svg+xml'
48
- get_local_asset 'editor/attires_disabled.svg', 'lib/public/attires_disabled.svg', 'image/svg+xml'
47
+ ['red', 'blue', 'green', 'black', 'attires_enabled', 'attires_disabled'].each { |name|
48
+ get_local_asset "editor/#{name}.svg", "lib/public/#{name}.svg", 'image/svg+xml'
49
+ }
49
50
  end
data/lib/checker.rb CHANGED
@@ -10,11 +10,7 @@ module Gobstones
10
10
  status = output[:status]
11
11
  result = output[:result]
12
12
 
13
- is_expected_timeout = result[:finalBoardError] &&
14
- result[:finalBoardError][:reason][:code] == 'timeout' &&
15
- @options[:expect_endless_while]
16
-
17
- return if is_expected_timeout
13
+ return if is_expected_timeout(result)
18
14
  assert_not_boom status, result
19
15
 
20
16
  expected_board = result[:extraBoard]
@@ -40,6 +36,8 @@ module Gobstones
40
36
  status = output[:status]
41
37
  result = output[:result]
42
38
 
39
+ return if is_expected_timeout(result)
40
+
43
41
  fail_with status: :check_error_failed_expected_boom,
44
42
  result: {
45
43
  initial: result[:initialBoard],
@@ -97,6 +95,12 @@ module Gobstones
97
95
  } if status == :runtime_error
98
96
  end
99
97
 
98
+ def is_expected_timeout(result)
99
+ result[:finalBoardError] &&
100
+ result[:finalBoardError][:reason][:code] == 'timeout' &&
101
+ @options[:expect_endless_while]
102
+ end
103
+
100
104
  def fail_with(error)
101
105
  fail error.to_json
102
106
  end
@@ -5,7 +5,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
5
5
 
6
6
  Mumukit.runner_name = 'gobstones'
7
7
  Mumukit.configure do |config|
8
- config.docker_image = 'mumuki/mumuki-gobstones-worker:2.0'
8
+ config.docker_image = 'mumuki/mumuki-gobstones-worker:3.0'
9
9
  config.content_type = 'html'
10
10
  config.structured = true
11
11
  end
@@ -47,7 +47,7 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
47
47
  def post_process_file(_file, result, status)
48
48
  if status == :passed
49
49
  result = result.parse_as_json
50
- status = :aborted if is_timeout? result and !@batch.options[:expect_endless_while]
50
+ status = :aborted if is_timeout? result and !expects_timeout?
51
51
  end
52
52
 
53
53
  [result, status]
@@ -55,6 +55,10 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
55
55
 
56
56
  private
57
57
 
58
+ def expects_timeout?
59
+ @batch.options[:expect_endless_while] || @batch.examples.any? { |it| it[:postconditions][:error] == 'timeout' }
60
+ end
61
+
58
62
  def is_timeout?(result)
59
63
  result[0]&.dig(:result, :finalBoardError, :reason, :code) === 'timeout'
60
64
  end