clean pull request
This commit is contained in:
29
.travis.yml
29
.travis.yml
@ -2,7 +2,6 @@ sudo: required
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
# https://docs.travis-ci.com/user/docker/
|
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
code_climate:
|
code_climate:
|
||||||
@ -11,21 +10,14 @@ addons:
|
|||||||
before_install:
|
before_install:
|
||||||
- export DISPLAY=:99.0
|
- export DISPLAY=:99.0
|
||||||
- sh -e /etc/init.d/xvfb start
|
- sh -e /etc/init.d/xvfb start
|
||||||
- echo 'DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --iptables=false"' | sudo tee /etc/default/docker > /dev/null
|
# Config to run docker tests - doesn't work so far
|
||||||
#- export DOCKER_HOST=tcp://192.168.23.75:2375
|
# - sudo apt-get update
|
||||||
- sudo service docker restart
|
# - sudo apt-get upgrade lxc-docker
|
||||||
- sleep 5
|
# - echo 'DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --iptables=false"' | sudo tee /etc/default/docker > /dev/null
|
||||||
#- docker pull openhpi/docker_java
|
# - export DOCKER_HOST=tcp://192.168.23.75:2375
|
||||||
- docker pull openhpi/docker_ruby
|
# - sudo service docker restart
|
||||||
# - docker pull openhpi/docker_python
|
# - sleep 5
|
||||||
|
# - docker pull openhpi/docker_ruby
|
||||||
#before_install:
|
|
||||||
# - sudo apt-get update
|
|
||||||
#- sudo apt-get upgrade lxc-docker
|
|
||||||
#- echo 'DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --iptables=false"' | sudo tee /etc/default/docker > /dev/null
|
|
||||||
#- sudo service docker restart
|
|
||||||
#- sleep 5
|
|
||||||
#- sudo docker pull weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION}
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- cp .rspec.travis .rspec
|
- cp .rspec.travis .rspec
|
||||||
@ -40,10 +32,11 @@ cache: bundler
|
|||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.3.1
|
- 2.3.1
|
||||||
# - 2.1.5
|
# - 2.1.5
|
||||||
# - 2.2.1
|
# - 2.2.1
|
||||||
|
|
||||||
script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper --tag ~docker
|
script: bundle exec rspec --color --format documentation --require spec_helper --require rails_helper --tag ~docker
|
||||||
|
# one of the solutions I've found
|
||||||
# - sudo docker run --rm=true -v `pwd`:/ansible-apache:rw weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION} /bin/bash -c "/ansible-apache/tests/test-in-docker-image.sh ${OS_TYPE} ${OS_VERSION} ${ANSIBLE_VERSION}"
|
# - sudo docker run --rm=true -v `pwd`:/ansible-apache:rw weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION} /bin/bash -c "/ansible-apache/tests/test-in-docker-image.sh ${OS_TYPE} ${OS_VERSION} ${ANSIBLE_VERSION}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ class ExecutionEnvironment < ActiveRecord::Base
|
|||||||
def working_docker_image?
|
def working_docker_image?
|
||||||
DockerClient.pull(docker_image) unless DockerClient.image_tags.include?(docker_image)
|
DockerClient.pull(docker_image) unless DockerClient.image_tags.include?(docker_image)
|
||||||
output = DockerClient.new(execution_environment: self).execute_arbitrary_command(VALIDATION_COMMAND)
|
output = DockerClient.new(execution_environment: self).execute_arbitrary_command(VALIDATION_COMMAND)
|
||||||
|
|
||||||
errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present?
|
errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present?
|
||||||
rescue DockerClient::Error => error
|
rescue DockerClient::Error => error
|
||||||
errors.add(:docker_image, "error: #{error}")
|
errors.add(:docker_image, "error: #{error}")
|
||||||
|
@ -52,4 +52,3 @@ test:
|
|||||||
<<: *default
|
<<: *default
|
||||||
host: tcp://192.168.59.104:2376
|
host: tcp://192.168.59.104:2376
|
||||||
workspace_root: <%= File.join('/', 'shared', Rails.env) %>
|
workspace_root: <%= File.join('/', 'shared', Rails.env) %>
|
||||||
#probably need to add some additional configuration here
|
|
||||||
|
@ -334,8 +334,8 @@ class DockerClient
|
|||||||
@execution_environment = options[:execution_environment]
|
@execution_environment = options[:execution_environment]
|
||||||
# todo: eventually re-enable this if it is cached. But in the end, we do not need this.
|
# 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.
|
# 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)
|
#@image = self.class.find_image_by_tag(@execution_environment.docker_image)
|
||||||
# fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
#fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.initialize_environment
|
def self.initialize_environment
|
||||||
|
@ -18,7 +18,6 @@ describe SubmissionsController do
|
|||||||
expect_assigns(submission: Submission)
|
expect_assigns(submission: Submission)
|
||||||
|
|
||||||
it 'creates the submission' do
|
it 'creates the submission' do
|
||||||
# pending("need to implement other pendings first")
|
|
||||||
expect { request.call }.to change(Submission, :count).by(1)
|
expect { request.call }.to change(Submission, :count).by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -189,7 +188,6 @@ describe SubmissionsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #score' do
|
describe 'GET #score' do
|
||||||
|
|
||||||
let(:request) { proc { get :score, id: submission.id } }
|
let(:request) { proc { get :score, id: submission.id } }
|
||||||
before(:each) { request.call }
|
before(:each) { request.call }
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ describe 'Editor', js: true do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'displays the exercise title' do
|
it 'displays the exercise title' do
|
||||||
# pending("no exercise title set")
|
|
||||||
expect(page).to have_content(exercise.title)
|
expect(page).to have_content(exercise.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -80,7 +79,6 @@ describe 'Editor', js: true do
|
|||||||
let(:file) { exercise.files.detect { |file| !file.file_type.binary? } }
|
let(:file) { exercise.files.detect { |file| !file.file_type.binary? } }
|
||||||
|
|
||||||
it "displays the file's code" do
|
it "displays the file's code" do
|
||||||
pending("need to make travis working again")
|
|
||||||
expect(page).to have_css(".frame[data-filename='#{file.name_with_extension}']")
|
expect(page).to have_css(".frame[data-filename='#{file.name_with_extension}']")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -7,10 +7,8 @@ describe DockerClient, docker: true do
|
|||||||
let(:execution_environment) { FactoryGirl.build(:ruby) }
|
let(:execution_environment) { FactoryGirl.build(:ruby) }
|
||||||
let(:image) { double }
|
let(:image) { double }
|
||||||
let(:submission) { FactoryGirl.create(:submission) }
|
let(:submission) { FactoryGirl.create(:submission) }
|
||||||
# let(:workspace_path) { '/tmp/codeocean_dockertest' }
|
|
||||||
let(:workspace_path) { '/tmp' }
|
let(:workspace_path) { '/tmp' }
|
||||||
|
|
||||||
|
|
||||||
describe '.check_availability!' do
|
describe '.check_availability!' do
|
||||||
context 'when a socket error occurs' do
|
context 'when a socket error occurs' do
|
||||||
it 'raises an error' do
|
it 'raises an error' do
|
||||||
|
@ -44,8 +44,6 @@ describe DockerContainerPool do
|
|||||||
|
|
||||||
it 'takes a container from the pool' do
|
it 'takes a container from the pool' do
|
||||||
expect(described_class).not_to receive(:create_container).with(@execution_environment)
|
expect(described_class).not_to receive(:create_container).with(@execution_environment)
|
||||||
# #<Double (anonymous)> received unexpected message :json with (no args)
|
|
||||||
# expect(described_class).to receive(:json).with()
|
|
||||||
expect(described_class.get_container(@execution_environment)).to eq(container)
|
expect(described_class.get_container(@execution_environment)).to eq(container)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -62,7 +60,6 @@ describe DockerContainerPool do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context 'when inactive' do
|
context 'when inactive' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
expect(described_class).to receive(:config).and_return(active: false)
|
expect(described_class).to receive(:config).and_return(active: false)
|
||||||
|
@ -21,7 +21,6 @@ describe ExecutionEnvironmentPolicy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
[:execute_command?, :shell?, :statistics?].each do |action|
|
[:execute_command?, :shell?, :statistics?].each do |action|
|
||||||
permissions(action) do
|
permissions(action) do
|
||||||
it 'grants access to admins' do
|
it 'grants access to admins' do
|
||||||
|
Reference in New Issue
Block a user