I'm working on a rails website, currently writing some unit, functional and integration tests.
The unit and integration test are running fine in development(my local machine) and production (on gitlab pipeline).
Strange thing is: functional test is failing on my local machine but passing in production pipeline!
I'm using rake to run my tests; rails 4.2 on macOS as my local machine setup, and gitlab is using docker to run the tests
what might be the issue?
Related
I'm interested in Docker as it creates a neat way of setting up an application environment.
EDIT : I'm on Digital Ocean Droplet created with their Docker 1 click Application.
Apparently there isn't a proper way to deploy a Rails application to production, or at least I haven't found it. The setup seems much more complicated then setting up the server from scratch and using Capistrano. I tried using Heroku but it doesn't entirely support Docker.
Is there any good guideline on how to setup Docker to deploy a simple Rails application on a production server?
I read/watched already this references:
The Quickstart: Docker Compose and Rails is ok for development, but then Using Compose in production is too rough and superficial.
The Docker for DevOps course: From development to pro
way too complex, but is the only that at the end tells you how to deploy Rails on Digital Ocean. Anyway there must be an easier way.
Deploying Your Docker Rails App
is just for Heroku.
Getting to know Centurion
does anyone use Centurion to deploy?
Docker + Capistrano = Warp Speed
a bit buggy and outdated.
Running multiple web applications on a Docker host with Apache
the right approach, shame is not for Rails..
Intro
Hi, I'm developing rails application, which use capybara, selenium-webdriver and rspec for tests.
Problem
Now I have a functional tests, which runs in firefox (default selenium browser) and works with redirects to other hosts. For example, rspec before hook to get fresh google access token.
Locally on my laptop all tests runs with success:
bundle exec rspec
But codeship's builds fails.
Questions
Do I need to setup codeship to support "firefox" tests? If yes, how can I do it?
Does codeship supports redirects to other hosts?
Thanks!
Codeship supports running selenium tests in the CI , you can find more info here https://documentation.codeship.com/continuous-integration/browser-testing/
However when i tried to run the selenium tests in CI , chrome failed to start 90% of the times , so i am planning to spin up a selenium grid elsewhere and run the tests in codeship
I've started learning to use Ruby on Rails running on Windows 7, and the time to run tests is painful I'm wondering if I can speed it up.
Right now I am using the default test framework (inheriting from ActionController), with a SQLite database and the webrick web server.
While unit and functional tests report a runtime of less than 2 seconds, from the time I run the tests from the command-line to completion is actually 40 secounds.
A friend recommended I use guard. That looks like it will help start the tests as soon as I save, but it seems like the real cost is starting up the webserver or database. I wonder if it might be better to set up apache or mysql and use those locally instead.
Anyhow, what tips do people have for speeding up ruby on rails tests on windows? I tried running the tests on Amazon EC2 linux micro instance (again with webrick and sqlite) and there was significant startup time (though I did not time it).
I tried "rake test --trace". There was a significant pause:
Immediately before the first line of output
Between outputing "Execute environment" and "Execute db:abort_if_pending_migrations"
Between "Execute test:units" and "Run options:"
The first pause seems worse.
Your best bet is to use spork which now works in Windows. It runs on windows by pre-populating a pool of ready processes (referred to as the “magazine” strategy). The result is that webserver startup time is dramatically reduced.
If running rails on Windows is really the bottleneck then you can run a virtual machine using VirtualBox and run an instance of Ubuntu and work on your rails projects in the VM.
Is it worth it to setup chef with vagrant to develop rails apps in windows (interrested in jruby) and then deploy it to cloud? I am trying to figure out how to setup a nice development environment for windows (windows 7 64 bit) but I am a bit lost.
Vagrant is a good tool to replicate production environments on your local machine. It lets you configure one or many VMs to simulate load balancers, web servers, and production data storage systems all on your computer.
Some people find it simpler to install Vagrant as a development environment as well. You get a shared folder that allows you to code on your host OS and then "deploy" immediately to a simulated production environment and test on your machine. However, it's not 100% necessary and some developers dislike having to fire up a VM to start coding.
I use a combination of both. I develop locally and test changes locally, and then I use Vagrant to fire up VMs and test my code in a simulated environment.
I'm finding the feedback look pretty slow when running integration and functional tests in Grails. Is there a way I can run them against a running server instance while I'm writing the tests, to save on server startup time each time they're executed?
You can use grails interactive which does what you want without starting a server. It starts a JVM and keeps it running and you can use it to run unit and integration tests. Keep in mind that you'll eventually run out of memory and need to restart periodically. See http://docs.grails.org/latest/guide/gettingStarted.html#usingInteractiveMode
Also in 1.3.5 you can run functional tests against a running server. Use the baseUrl attribute described in section 9.3 at http://grails.org/doc/latest/
there's an option --baseUrl
e.g.
grails test-app --baseUrl=http://localhost:8080/myapp/
that runs tests against a running instance, one draw back is that the slate isn't wiped clean after a test, so if your test writes to the db, uploads a file, or some other permanent change to the application, then you may have to do some tearDown.
This is briefly documented at the end of the function testing section of the grails docs
http://grails.org/doc/latest/guide/testing.html#functionalTesting
It's useful for writing/debugging functional tests
I'm using Grails 1.3.5 and the EasyB plugin for stories in the context of functional tests.
Take a look at http://padcom13.blogspot.com/2010/10/grails-easyb-and-selenium.html for step-by-step instructions.