Add seperate test container and fix server tests

This commit is contained in:
Ari Timonen 2020-03-15 16:55:52 +02:00
parent bdbdef1635
commit 2784a6cd74
5 changed files with 88 additions and 55 deletions

View file

@ -0,0 +1,7 @@
class AddCategoryIdToServerVersions < ActiveRecord::Migration
def change
change_table :server_versions do |s|
s.integer :category_id
end
end
end

View file

@ -11,21 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190917222520) do
create_table "admin_requests", force: true do |t|
t.string "addr"
t.string "pwd"
t.integer "server_id"
t.string "player"
t.integer "user_id"
t.string "msg"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "admin_requests", ["server_id"], name: "index_admin_requests_on_server_id", using: :btree
add_index "admin_requests", ["user_id"], name: "index_admin_requests_on_user_id", using: :btree
ActiveRecord::Schema.define(version: 20200315144657) do
create_table "article_versions", force: true do |t|
t.integer "article_id"
@ -202,8 +188,8 @@ ActiveRecord::Schema.define(version: 20190917222520) do
create_table "custom_urls", force: true do |t|
t.string "name"
t.integer "article_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "custom_urls", ["article_id"], name: "index_custom_urls_on_article_id", using: :btree
@ -226,16 +212,6 @@ ActiveRecord::Schema.define(version: 20190917222520) do
add_index "data_files", ["directory_id"], name: "index_data_files_on_directory_id", using: :btree
add_index "data_files", ["related_id"], name: "index_data_files_on_related_id", using: :btree
create_table "deleteds", force: true do |t|
t.integer "deletable_id"
t.string "deletable_type"
t.integer "user_id"
t.text "reason"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "related_id"
end
create_table "directories", force: true do |t|
t.string "name"
t.string "description"
@ -248,21 +224,6 @@ ActiveRecord::Schema.define(version: 20190917222520) do
add_index "directories", ["parent_id"], name: "index_directories_on_parent_id", using: :btree
create_table "firms", force: true do |t|
t.string "name"
t.string "y_code"
t.string "email"
t.string "website"
t.string "phone"
t.string "address"
t.integer "zipcode"
t.string "town"
t.integer "owner"
t.string "opentime"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "forumers", force: true do |t|
t.integer "forum_id"
t.integer "group_id"
@ -449,7 +410,6 @@ ActiveRecord::Schema.define(version: 20190917222520) do
t.integer "status"
end
add_index "match_proposals", ["match_id"], name: "index_match_proposals_on_match_id", using: :btree
add_index "match_proposals", ["status"], name: "index_match_proposals_on_status", using: :btree
create_table "matchers", force: true do |t|
@ -543,13 +503,6 @@ ActiveRecord::Schema.define(version: 20190917222520) do
add_index "movies", ["status"], name: "index_movies_on_status", using: :btree
add_index "movies", ["user_id"], name: "index_movies_on_user_id", using: :btree
create_table "nodes", force: true do |t|
t.string "name"
t.integer "foreign_key"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "options", force: true do |t|
t.string "option"
t.integer "poll_id"
@ -653,10 +606,10 @@ ActiveRecord::Schema.define(version: 20190917222520) do
t.boolean "notify_gather"
t.boolean "notify_own_match"
t.boolean "notify_any_match"
t.boolean "notify_pms", default: true, null: false
t.boolean "notify_challenge", default: true, null: false
t.boolean "notify_pms", default: true, null: false
t.boolean "notify_challenge", default: true, null: false
t.string "steam_profile"
t.string "achievements_parsed"
t.string "achievements_parsed", limit: 400
t.text "signature_parsed"
t.string "stream"
t.string "layout"
@ -737,6 +690,7 @@ ActiveRecord::Schema.define(version: 20190917222520) do
t.integer "players"
t.integer "max_players"
t.string "ping"
t.integer "category_id"
end
add_index "server_versions", ["server_id"], name: "index_server_versions_on_server_id", using: :btree
@ -783,6 +737,18 @@ ActiveRecord::Schema.define(version: 20190917222520) do
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
create_table "shoutmsg_archive", force: true do |t|
t.integer "user_id"
t.string "text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "shoutable_type"
t.integer "shoutable_id"
end
add_index "shoutmsg_archive", ["shoutable_type", "shoutable_id"], name: "index_shoutmsgs_on_shoutable_type_and_shoutable_id", using: :btree
add_index "shoutmsg_archive", ["user_id"], name: "index_shoutmsgs_on_user_id", using: :btree
create_table "shoutmsgs", force: true do |t|
t.integer "user_id"
t.string "text"

View file

@ -15,10 +15,50 @@ services:
- ".:/var/www/"
ports:
- "4000:4000"
- "35729:35729"
links:
- db
- memcached
# - redis
- selenium
#- redis
test:
# Debug
#stdin_open: true
command: ["/bin/bash", "-c", "--", "while true; do sleep 100; done;"]
build:
context: ./
dockerfile: Dockerfile.dev
args:
buildno: 1
env_file:
- .env.test
ports:
- 3005:3005 # Capybara listens here
links:
- db
- selenium
volumes:
- ".:/var/www"
# command: bin/spring server
environment:
TEST_APP_HOST: test
TEST_APP_PORT: 3005
SELENIUM_HOST: selenium
RAILS_ENV: test
networks:
default:
aliases:
- test
redis:
image: 'redis:4.0-alpine'
selenium:
image: selenium/standalone-chrome-debug
ports:
- 5900:5900
db:
# Debug
#command: bash
@ -35,6 +75,7 @@ services:
- MYSQL_PASSWORD=ensl
- MYSQL_ROOT_PASSWORD=ensl
- MYSQL_ROOT_HOST=%
memcached:
image: memcached:latest
#redis:

View file

@ -6,6 +6,7 @@ require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'spec_helper'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
@ -21,7 +22,7 @@ require 'rspec/rails'
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| print "importing " + f + "\r\n"; require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.

View file

@ -22,6 +22,24 @@ Capybara.register_driver :poltergeist do |app|
)
end
SELENIUM_HOST = ENV['SELENIUM_HOST']
TEST_APP_HOST = ENV['TEST_APP_HOST']
TEST_APP_PORT = ENV['TEST_APP_PORT']
Capybara.register_driver :selenium_remote do |app|
Capybara::Selenium::Driver.new(
app,
browser: :remote,
url: "http://#{SELENIUM_HOST}:4444/wd/hub",
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome
)
end
Capybara.javascript_driver = :selenium_remote
Capybara.server_port = TEST_APP_PORT
Capybara.server_host = '0.0.0.0'
Capybara.app_host = "http://#{TEST_APP_HOST}:#{TEST_APP_PORT}"
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause