It appears that the new docker images in CircleCI 2.0 are restricting certain network traffic that wouldn’t have been restricted in CircleCI 1.0. When I run my tests using my old 1.0 config file, they all pass as expected. When I run my tests using my new 2.0 config file, two tests fail. The tests that fail are ones that get data from the Facebook API.
Is there something wrong with my configuration? The actual codebases are exactly the same, which is why I’m so confused as to why certain tests pass under one version of CircleCI and fail under another. Is there something I can change in my CircleCI 2.0 configuration file to give me a better chance of my tests passing? Like, for example, should I be using a different OpenJDK8 image?
Below are my config files - the first is my old circle.yml
file for 1.0 and the second is my new config.yml
file for 2.0. I use CircleCI to test Scala programs via sbt.
1.0:
machine:
java:
version: openjdk8
environment:
SBT_VERSION: 0.13.11
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m -Xss2m"
TZ: UTC
dependencies:
override:
- wget -q https://dl.bintray.com/sbt/debian/sbt-${SBT_VERSION}.deb
- sudo dpkg -i sbt-${SBT_VERSION}.deb
- sbt clean compile # compile here so that dependencies are cached
cache_directories:
- "~/.ivy2"
- "~/.sbt"
database:
override:
- >
export DEBIAN_FRONTEND=noninteractive
&& sudo apt-get -y remove --purge mysql*
&& sudo apt-get -y autoremove
&& sudo apt-get -y autoclean
&& sudo rm -rf /etc/mysql /var/lib/mysql
&& sudo apt-add-repository -y 'deb http://ppa.launchpad.net/ondrej/mysql-experimental/ubuntu precise main'
&& sudo apt-get update
&& sudo apt-get -y install software-properties-common
&& sudo apt-get -y install mysql-server-5.6
- mysql --version
- mysqladmin -u root password root
- mysql -uroot -proot -e 'DROP DATABASE IF EXISTS test; CREATE DATABASE test;'
test:
override:
- sbt "test-only test.* -- exclude broken"
2.0:
version: 2
jobs:
build:
docker:
# The first image is the primary container where tests are run
- image: circleci/openjdk:8-jdk-browsers
environment:
SBT_VERSION: 0.13.11
_JAVA_OPTIONS: "-Xms1024m -Xmx3072m -Xss2m -Duser.country=US"
TZ: UTC
- image: mysql:5.6
environment:
- MYSQL_DATABASE: test
- MYSQL_ROOT_PASSWORD: root
steps:
- checkout
- run:
name: Install sbt
command: |
sudo apt install apt-transport-https
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt update
sudo apt install sbt
- restore_cache:
keys:
- v1-sbt-{{ checksum "build.sbt" }}
- run: sbt clean update
- run: sbt compile
- run: sbt test:compile
- save_cache:
key: v1-sbt-{{ checksum "build.sbt" }}
paths:
- "~/.ivy2"
- "~/.sbt"
- run: sbt "test-only test.* -- exclude broken"