Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CentOS on Travis CI. #989

Merged
merged 1 commit into from
Jul 30, 2018
Merged

Conversation

junaruga
Copy link
Contributor

Related: #988 .

@@ -135,15 +136,22 @@ def connect(*args)

# You may need to adjust the lines below to match your SSL certificate paths
ssl_client = nil
option_overrides = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This modification is to pass the test on the CentOS environment that does not have /etc/mysql/*.pem files.

@@ -164,7 +164,7 @@
expect do
res.each_with_index do |_, i|
# Exhaust the first result packet then trigger a timeout
sleep 2 if i > 0 && i % 1000 == 0
sleep 4 if i > 0 && i % 1000 == 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This modification is to pass the test on CentOS.

@@ -1,5 +1,6 @@
require 'spec_helper'

# rubocop:disable Metrics/BlockLength
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By below modification, the length of the block is more than the limitation.
As I was not sure how to fix, I added this ignored line.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See file .rubocop_todo.yml.

But you may be right that the better approach is not to globally increase the limit, but to ignore it for this file and have a more sensible limit apply everywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will change current limit 850 to 860 to prevent below situation.

spec/mysql2/client_spec.rb:3:1: C: Metrics/BlockLength: Block has too many lines. [851/850]

@@ -73,6 +74,12 @@ matrix:
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is a little bit tricky. Actually the tested Ruby on CentOS is not Ruby 2.4 but default installed Ruby on CentOS. But I was not sure how to update rvm: foo to show rvm is not used directly on Travis.

sh .travis_setup_centos.sh

# To avoid install error.
sed -i '/eventmachine/d' Gemfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Can't we fix the install error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.
It is to avoid install error by bundle install on CentOS.
But let me check again to fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason of the error is just because g++ command was not installed on the environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it and rebased.

@junaruga junaruga force-pushed the feature/travis-centos branch from 32118f0 to 1c126cc Compare June 29, 2018 08:45
.travis.yml Outdated
@@ -73,6 +74,12 @@ matrix:
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.4
# Mark
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is Mark?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Mark" is not people's name in this case. I want to describe env: DOCKER=centos is just used to identify this test case from Travis test page. But I am going to remove the line.

@@ -0,0 +1,6 @@
FROM centos
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to use tagged version with centos:7.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right. I will change it to centos:7.

set -eux

# Install dependency packages and start mysqld service.
sh .travis_setup_centos.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go into the Dockerfile, so that you can benefit from layer caching of these dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right. Let me move the logic to the Dockefile.

Copy link
Contributor Author

@junaruga junaruga Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem to move the .travis_setup_centos.sh to Dockerfile RUN (that is executed on docker build's timing).
We can not start mysqld daemon service in the process of docker build. (Can not access the service).
So, I moved only the part to install dependency to the Dockerfile RUN part.
I added the modification as another commit to see the change easily for now.
How?
Thank you for the checking.

@@ -1,5 +1,6 @@
require 'spec_helper'

# rubocop:disable Metrics/BlockLength
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See file .rubocop_todo.yml.

But you may be right that the better approach is not to globally increase the limit, but to ignore it for this file and have a more sensible limit apply everywhere else.

@sodabrew sodabrew added this to the 0.5.3 milestone Jul 4, 2018
@junaruga
Copy link
Contributor Author

@sodabrew thank you for the review! I am sorry I did not noticed until now. I will check those later.

@junaruga junaruga force-pushed the feature/travis-centos branch 2 times, most recently from 9524d5a to d697180 Compare July 30, 2018 16:37
@junaruga
Copy link
Contributor Author

@sodabrew I modified it!

@sodabrew
Copy link
Collaborator

Looks good to me! Are you ready for merge, or still hacking on this PR?

@junaruga junaruga force-pushed the feature/travis-centos branch from b3da64b to f72a894 Compare July 30, 2018 19:46
@junaruga
Copy link
Contributor Author

@sodabrew I am ready for merge! I did squash the 2 commits to 1 commit now.

@sodabrew sodabrew merged commit bc73887 into brianmario:master Jul 30, 2018
@junaruga
Copy link
Contributor Author

Thank you! 😄

@junaruga junaruga deleted the feature/travis-centos branch July 31, 2018 09:41
jeremy added a commit to jeremy/mysql2 that referenced this pull request Mar 5, 2019
* upstream/master:
  Expose windows client authentication (brianmario#1018)
  Fix code snippet (brianmario#1002)
  Add CentOS on Travis CI. (brianmario#989)
  Bump version to 0.5.2
  Travis apt-get update for MySQL 5.5 install
  Updating the mysql2_mysql_enc_to_rb conversion table to 8.0 List (brianmario#976)
  Add default-libmysqlclient-dev to the likely packages list
  Bump version to 0.5.1
  Use the prepared statement performance schema if available (brianmario#960)
  README mysql2 0.5.x works with Rails 5.0.7, 5.1.6, and higher
  README be sure to read about the known limitations of prepared statements
  Add missing FREE_BINDS to prepared statement streaming error case (brianmario#958)
  Fix with --with-mysql-dir (brianmario#952)
  Prevent command out of sync errors with Prepared Statements (brianmario#958)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants