Run tests for LHM with dev and shopify-build#32
Conversation
* Do not specify dependencies in Gemfile (this is a gem) * rake was already in gemspec causing bundler to complain * added package_cloud to gemspec * Change `mysql` to `mysql2` because `mysql` is so ancient it won't even compile * Add Gemfile.lock - this is now considered best practice: rubygems/bundler#6184
e638ed1 to
ca73bb7
Compare
ca73bb7 to
d78548d
Compare
|
@sroysen I've added the proper commands so |
dev and shopify-build
|
|
||
| describe 'with MySQL stopped on the slave' do | ||
| it 'assumes 0 slave lag' do | ||
| skip "Failing test that needs review" |
There was a problem hiding this comment.
Backtrace:
NoMethodError: undefined method `exclude?' for []:Array
/Users/brianb/src/github.com/Shopify/lhm/lib/lhm/throttler/slave_lag.rb:65:in `get_slaves'
/Users/brianb/src/github.com/Shopify/lhm/lib/lhm/throttler/slave_lag.rb:55:in `slaves'
/Users/brianb/src/github.com/Shopify/lhm/lib/lhm/throttler/slave_lag.rb:82:in `max_current_slave_lag'
/Users/brianb/src/github.com/Shopify/lhm/spec/unit/throttler/slave_lag_spec.rb:217:in `block (4 levels) in <top (required)>'
Original commit: a0df0e9
There was a problem hiding this comment.
So, I think we have a hidden dependency on ActiveSupport?
We could always make the dependency explicit, given that LHM is usually only ran in a Rails context.
| @@ -1,4 +1,5 @@ | |||
| # Large Hadron Migrator [![Build Status][5]][4] | |||
| # Large Hadron Migrator | |||
| [](https://buildkite.com/shopify/lhm) | |||
There was a problem hiding this comment.
May want to add a note about how this LHM is a downstream fork for our usages as this is a public repository.
install.sh
Outdated
| wget -q $origin/$filename.tar.gz | ||
| tar -xzf $filename.tar.gz | ||
| chmod +x $filename | ||
| sudo mv $filename /usr/local/bin/dbdeployer |
There was a problem hiding this comment.
Is there a reason why we don't use docker-compose like we do in Ghostferry? This would save all this code of having to download a custom tool and mysql.
I'm somewhat sketched out that this script would install something into my /usr and that this is a hard requirement for running integration tests. If we need to stick with this setup for some requirement and can't use docker-compose, we could unpack this into a vendor directory or even just distribute the binary with this repo and call the executable via relative paths.
There was a problem hiding this comment.
I have to take responsibility for using dbdeployer in this use case. I suggested Brian to go with it.
IIRC, configuring a master-slave replication arrangement with docker compose was not solved out of the box.
Docker compose may be good enough for test suites, but I want us to get familiar with a tool that is going to allow us to start and stop mysql replicated clusters at will and easily in our machines.
Doing that with docker compose just to test something, is far from trivial.
README.md
Outdated
| ### dbdeployer | ||
| The integration tests rely on a master/slave replication setup of MySQL. | ||
| We're using [dbdeployer](https://github.com/datacharmer/dbdeployer) to set this up via `./install.sh`. | ||
| `dbdeployer` provides scripts for operating and accessing the nodes in `$HOME/sandboxes/rsandbox_5_7_22`. |
There was a problem hiding this comment.
I'm not the biggest fan that the test for this project will interfere with my $HOME. A directory with a name like sandboxes is fairly generic and could contain other stuff unrelated to mysql. This would mess with that organization.
Maybe it's better to have this install the mysql instances directly in this directory, or under some sort of ~/.directory.
insom
left a comment
There was a problem hiding this comment.
Thank you for doing this! It's going to help with our confidence to make changes to LHM (and to ship them to production in future).
I have some of the same concerns as Shuhao about what this will do to the users machine, and also the use of dbdeployer instead of docker-compose.
I can see that dbdeployer is the more convenient tool, from a database perspective, but there's lots of test environments in Shopify (and even in datastores!) using Docker Compose and Dockerized MySQL -- I wonder how much it's worth using a database specific tool for this, vs. tools other teams are using.
I'm still basically 👍 on having this -- and maybe this is all fine for LHM -- it's written and passing -- but as feedback for future testing environments, I think as a team we should pick one method of doing this, and stick with it.
| run: | ||
| - bundle check || bundle install | ||
| - sudo apt-get update | ||
| - sudo apt-get install numactl libaio-dev |
There was a problem hiding this comment.
What is numactl needed for? Seems like an odd dependency.
There was a problem hiding this comment.
Answering my own question, in case others have it: looks like dbdeployer
|
|
||
| describe 'with MySQL stopped on the slave' do | ||
| it 'assumes 0 slave lag' do | ||
| skip "Failing test that needs review" |
There was a problem hiding this comment.
So, I think we have a hidden dependency on ActiveSupport?
We could always make the dependency explicit, given that LHM is usually only ran in a Rails context.
ed0e860 to
7c30e25
Compare
These tests are critical to exercising LHM. We need this to be as easy as possible for developers to run, so let's automate it.
The exclude method on enumerable is provided by activesupport, which this gem does not currently include its gemspec. Although we could add it, it's simpler to just prefer the built in `include?`
7c30e25 to
accdd06
Compare
These tests are critical to exercising LHM. We need this to be as easy as
possible for developers to run locally and in CI, so let's automate it.
This also fixes dependencies:
mysqltomysql2becausemysqlis so ancient it won't evencompile
Update docs to reflect revised guidance to check in locks for gems rubygems/bundler#6184
Test with:
Hello Shopify Build 👋
This PR adds Shopify Build to this repository.
Please review this PR before merging it!
shipit.ymlconfiguration file as it may be configured to depend on the CircleCI status. You can reference a pipeline in theshipit.ymlfile by usingbuildkite/lhmas seen here.CODECOV_TOKENenvironment variable to your Shopify Build pipeline. The token can be found at codecov and should be placed in the environment section of the.shopify-build/secrets.ejsonfile. More info.[ci skip]part from the commit message:git rebase -i 65d89a437ead5d4b8548dbfcb74bcfe42dffd2c3Cleanup After Merging
spy build branch filter clear lhm.spy circle remove Shopify/lhm.masterbranch that their PRs are failing, because they are missing the necessary configuration files. You can use the following reply: “We migrated this repository from CircleCI to Shopify Build. Your build is failing, because your branch doesn't include the necessary configuration files. The configuration files are missing because your branch is behind themasterbranch. You should rebase your branch to make the build pass withgit pull --rebase origin master”Questions about this PR?
Join the
#shopify-buildSlack channel.Annoyed by how much you have to do yourself? Make it better in spy.