Skip to content

Commit

Permalink
Twitter OSS: Consistently skip flaky tests in projects
Browse files Browse the repository at this point in the history
Summary: Problem

The build.sbt files for util, scrooge, finagle, twitter-server, and
finatra do not consistently set the SKIP_FLAKY system
property by default for tests. Additionally, the travis configuration
for said projects is inconsistent, making it hard to spot potential
issues.

Solution

Try to fork when testing and pass the SKIP_FLAKY paramater
to the forked testing process. Every project already specified
that parallel test running in the forked process should be disabled.
However in the case of Finagle this was not enough, so an
additional restriction was added (like in Finatra) to ensure that
tests are not run in parallel in the forked process since test
state will collide.

Result

Tests marked as flaky will be skipped when building with sbt.

JIRA Issues: CSL-5017

Differential Revision: https://phabricator.twitter.biz/D86877
  • Loading branch information
cacoco authored and jenkins committed Sep 1, 2017
1 parent 3bcf07d commit 66e8859
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This is necessary until https://github.com/travis-ci/travis-ci/issues/3120 is
# fixed
sudo: required
# container-based build
sudo: false

language: scala

Expand All @@ -10,10 +9,15 @@ env:
# These directories are cached to S3 at the end of the build
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.ivy2
- $HOME/.sbt/boot/scala-$TRAVIS_SCALA_VERSION
- $HOME/.dodo

before_cache:
# Tricks to avoid unnecessary cache updates
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete

scala:
- 2.11.11
- 2.12.1
Expand Down
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ val sharedSettings = Seq(
javacOptions ++= Seq("-Xlint:unchecked", "-source", "1.8", "-target", "1.8"),
javacOptions in doc := Seq("-source", "1.8"),

fork in Test := true,
javaOptions in Test := Seq("-DSKIP_FLAKY=true"),

// This is bad news for things like com.twitter.util.Time
parallelExecution in Test := false,

Expand Down

0 comments on commit 66e8859

Please sign in to comment.