diff --git a/.travis.yml b/.travis.yml index 7a64549e..08922270 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ rvm: # - 2.3.1 #script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper --tag ~docker - - 2.1.5 - - 2.2.1 +# - 2.1.5 +# - 2.2.1 - 2.3.1 -script: bundle exec rspec --require spec_helper --require rails_helper --tag ~docker +script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index e236ebeb..baf08cae 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -271,7 +271,7 @@ class SubmissionsController < ApplicationController def stop Rails.logger.debug('stopping submission ' + @submission.id.to_s) - container = Docker::Container.get(params[:containtier_id]) + container = Docker::Container.get(params[:container_id]) DockerClient.destroy_container(container) rescue Docker::Error::NotFoundError ensure diff --git a/lib/docker_client.rb b/lib/docker_client.rb index f6fb9e2c..9d2f30b6 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -25,10 +25,9 @@ class DockerClient #container.exec(['bash', '-c', 'rm -rf ' + CONTAINER_WORKSPACE_PATH + '/*']) local_workspace_path = local_workspace_path(container) - path_to_delete = Pathname.new(local_workspace_path) - if local_workspace_path || Pathname.new(local_workspace_path).exist? - path_to_delete.children.each{ |p| p.rmtree} - #FileUtils.rmdir(path_to_delete) + if local_workspace_path && Pathname.new(local_workspace_path).exist? + Pathname.new(local_workspace_path).children.each{ |p| p.rmtree} + #FileUtils.rmdir(Pathname.new(local_workspace_path)) end end @@ -193,8 +192,6 @@ class DockerClient if(container) container.delete(force: true, v: true) end - local_workspace_path(container) - rescue Docker::Error::NotFoundError => error Rails.logger.error('destroy_container: Rescued from Docker::Error::NotFoundError: ' + error.to_s) Rails.logger.error('No further actions are done concerning that.') @@ -332,11 +329,13 @@ class DockerClient Docker::Image.all.map { |image| image.info['RepoTags'] }.flatten.reject { |tag| tag.include?('') } end -# When @image commented test doesn't work +# When @image commented test doesn't work -> test set to pending def initialize(options = {}) @execution_environment = options[:execution_environment] - @image = self.class.find_image_by_tag(@execution_environment.docker_image) - fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image + # todo: eventually re-enable this if it is cached. But in the end, we do not need this. + # docker daemon got much too much load. all not 100% necessary calls to the daemon were removed. + #@image = self.class.find_image_by_tag(@execution_environment.docker_image) + #fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image end def self.initialize_environment diff --git a/lib/xikolo/client.rb b/lib/xikolo/client.rb index 66fab666..06e4ecf4 100644 --- a/lib/xikolo/client.rb +++ b/lib/xikolo/client.rb @@ -56,4 +56,4 @@ class Xikolo::Client def self.authentication_url return @url + 'authenticate' end -end +end \ No newline at end of file diff --git a/spec/policies/execution_environment_policy_spec.rb b/spec/policies/execution_environment_policy_spec.rb index 8bede9e1..799881b5 100644 --- a/spec/policies/execution_environment_policy_spec.rb +++ b/spec/policies/execution_environment_policy_spec.rb @@ -21,8 +21,7 @@ describe ExecutionEnvironmentPolicy do end end - - [:execute_command?, :shell?, :statistics?].each do |action| + [:destroy?, :edit?, :execute_command?, :shell?, :show?, :update?].each do |action| permissions(action) do it 'grants access to admins' do expect(subject).to permit(FactoryGirl.build(:admin), execution_environment) @@ -39,22 +38,4 @@ describe ExecutionEnvironmentPolicy do end end end - - [:destroy?, :edit?, :show?, :update?].each do |action| - permissions(action) do - it 'grants access to admins' do - expect(subject).to permit(FactoryGirl.build(:admin), execution_environment) - end - - it 'does not grant access to authors' do - expect(subject).not_to permit(execution_environment.author, execution_environment) - end - - it 'does not grant access to all other users' do - [:external_user, :teacher].each do |factory_name| - expect(subject).not_to permit(FactoryGirl.build(factory_name), execution_environment) - end - end - end - end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 320310a2..0ea8706a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,9 +15,6 @@ # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -require "codeclimate-test-reporter" -CodeClimate::TestReporter.start - unless RUBY_PLATFORM == 'java' if ENV['CODECLIMATE_REPO_TOKEN'] require 'codeclimate-test-reporter' @@ -28,9 +25,6 @@ unless RUBY_PLATFORM == 'java' end end -require 'selenium-webdriver' -#Selenium::WebDriver::Firefox::Binary.path='/usr/bin/firefox' - RSpec.configure do |config| # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with @@ -39,11 +33,6 @@ RSpec.configure do |config| config.filter_run :focus config.run_all_when_everything_filtered = true - - #for --next-failure feature purpose - config.example_status_persistence_file_path = "examples.txt" - config.run_all_when_everything_filtered = true - # Many RSpec users commonly either run the entire suite or an individual # file, and it's useful to allow more verbose output when running an # individual spec file.