Skip to content

Commit 926bfdb

Browse files
nicktatefacebook-github-bot
authored andcommitted
Container Testing Updates
Summary: ericvicenti Here is the latest updates and fixes for the container testing. Everything should be good to go now, the update for `inotify.max_user_watches` should fix the E2E test issues you were seeing locally. The update to the packer prevents excessively large filename lengths due to the hash used in the name and splits them into directories instead. I was getting errors locally on the E2E because the hash filename was over 248 characters which was causing issues on the base image file system. It might not have appeared in circle due to another file system being used with different limits. I can separate it out into another PR if you want though. * Turned jenkins instrumentation parallelism up to 3 * Disabled various instrumentation tests that seemed to have inconsistent results from Jenkins by default * Install google-chrome in the android base image so the chrome debug E2E test does not fail * Turned back on E2E tests cc normanjoyner Closes facebook#13417 Differential Revision: D4876137 Pulled By: ericvicenti fbshipit-source-id: 31e033c1e34b02acb5484478414197ac9eb11f95
1 parent 01d4a1c commit 926bfdb

5 files changed

+33
-21
lines changed

ContainerShip/Dockerfile.android-base

+7-1
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Intel x
8686
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Google APIs, Android API 23, revision 1" | awk '{ print $1 }' | sed 's/.$//')
8787

8888
# Android Support Repository, revision 45
89-
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android Support Repository, revision 45" | awk '{ print $1 }' | sed 's/.$//')
89+
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android Support Repository" | awk '{ print $1 }' | sed 's/.$//')
9090

9191
# Link adb executable
9292
RUN ln -s /opt/android/platform-tools/adb /usr/bin/adb
9393

94+
# Install google-chrome
95+
RUN curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
96+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
97+
&& apt-get update \
98+
&& apt-get install -y google-chrome-stable
99+
94100
# clean up unnecessary directories
95101
RUN rm -rf /opt/android/system-images/android-19/default/x86

ContainerShip/scripts/run-android-ci-instrumentation-tests.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ const child_process = require('child_process');
2828
const fs = require('fs');
2929
const path = require('path');
3030

31-
// Flaky tests ignored on Circle CI. They still run internally at fb.
32-
const ignoredTests = [
33-
'ReactScrollViewTestCase',
34-
'ReactHorizontalScrollViewTestCase'
35-
];
36-
3731
const colors = {
3832
GREEN: '\x1b[32m',
3933
RED: '\x1b[31m',
@@ -42,6 +36,7 @@ const colors = {
4236

4337
const test_opts = {
4438
FILTER: new RegExp(argv.filter || '.*', 'i'),
39+
IGNORE: argv.ignore || null,
4540
PACKAGE: argv.package || 'com.facebook.react.tests',
4641
PATH: argv.path || './ReactAndroid/src/androidTest/java/com/facebook/react/tests',
4742
RETRIES: parseInt(argv.retries || 2, 10),
@@ -59,14 +54,21 @@ let testClasses = fs.readdirSync(path.resolve(process.cwd(), test_opts.PATH))
5954
return file.endsWith('.java');
6055
}).map((clazz) => {
6156
return path.basename(clazz, '.java');
62-
}).filter(className => {
63-
return ignoredTests.indexOf(className) === -1;
64-
}).map((clazz) => {
65-
return test_opts.PACKAGE + '.' + clazz;
66-
}).filter((clazz) => {
67-
return test_opts.FILTER.test(clazz);
6857
});
6958

59+
if (test_opts.IGNORE) {
60+
test_opts.IGNORE = new RegExp(test_opts.IGNORE, 'i');
61+
testClasses = testClasses.filter(className => {
62+
return !test_opts.IGNORE.test(className);
63+
});
64+
}
65+
66+
testClasses = testClasses.map((clazz) => {
67+
return test_opts.PACKAGE + '.' + clazz;
68+
}).filter((clazz) => {
69+
return test_opts.FILTER.test(clazz);
70+
});
71+
7072
// only process subset of the tests at corresponding offset and count if args provided
7173
if (test_opts.COUNT != null && test_opts.OFFSET != null) {
7274
const testCount = testClasses.length;

ContainerShip/scripts/run-ci-e2e-tests.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ RUN_CLI_INSTALL=1
1111
RUN_IOS=0
1212
RUN_JS=0
1313

14-
RETRY_COUNT=${RETRY_COUNT:-1}
14+
RETRY_COUNT=${RETRY_COUNT:-2}
1515
AVD_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
1616

1717
ANDROID_NPM_DEPS="appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1"
1818
CLI_PACKAGE=$ROOT/react-native-cli/react-native-cli-*.tgz
1919
PACKAGE=$ROOT/react-native-*.tgz
2020
REACT_NATIVE_MAX_WORKERS=1
2121

22+
# solve issue with max user watches limit
23+
echo 65536 | tee -a /proc/sys/fs/inotify/max_user_watches
24+
watchman shutdown-server
25+
2226
# retries command on failure
2327
# $1 -- max attempts
2428
# $2 -- command to run
@@ -177,7 +181,6 @@ function e2e_suite() {
177181
cd ..
178182
keytool -genkey -v -keystore android/keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"
179183

180-
echo "Starting packager server"
181184
node ./node_modules/.bin/appium >> /dev/null &
182185
APPIUM_PID=$!
183186
echo "Starting appium server $APPIUM_PID"
@@ -193,6 +196,7 @@ function e2e_suite() {
193196
return 1
194197
fi
195198

199+
echo "Starting packager server"
196200
npm start >> /dev/null &
197201
SERVER_PID=$!
198202
sleep 15

Jenkinsfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ def getParallelInstrumentationTests(testDir, parallelCount, imageName) {
5252
def testCount = sh(script: "ls ${testDir} | wc -l", returnStdout: true).trim().toInteger()
5353
def testPerParallel = testCount.intdiv(parallelCount) + 1
5454

55+
def ignoredTests = 'CatalystNativeJavaToJSReturnValuesTestCase|CatalystUIManagerTestCase|CatalystMeasureLayoutTest|CatalystNativeJavaToJSArgumentsTestCase|CatalystNativeJSToJavaParametersTestCase|ReactScrollViewTestCase|ReactHorizontalScrollViewTestCase|ViewRenderingTestCase';
56+
5557
for (def x = 0; (x*testPerParallel) < testCount; x++) {
5658
def offset = x
5759
integrationTests["android integration tests: ${offset}"] = {
5860
run: {
59-
runCmdOnDockerImage(imageName, "bash /app/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh --offset=${offset} --count=${testPerParallel}", '--privileged --rm')
61+
runCmdOnDockerImage(imageName, "bash /app/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh --offset=${offset} --count=${testPerParallel} --ignore=\"${ignoredTests}\"", '--privileged --rm')
6062
}
6163
}
6264
}
@@ -106,7 +108,7 @@ def runStages() {
106108
jsImageName = "${buildInfo.image.name}-js:${jsTag}"
107109
androidImageName = "${buildInfo.image.name}-android:${androidTag}"
108110

109-
parallelInstrumentationTests = getParallelInstrumentationTests('./ReactAndroid/src/androidTest/java/com/facebook/react/tests', 1, androidImageName)
111+
parallelInstrumentationTests = getParallelInstrumentationTests('./ReactAndroid/src/androidTest/java/com/facebook/react/tests', 3, androidImageName)
110112

111113
parallel(
112114
'javascript build': {
@@ -148,9 +150,7 @@ def runStages() {
148150
runCmdOnDockerImage(androidImageName, 'bash /app/ContainerShip/scripts/run-android-docker-unit-tests.sh', '--privileged --rm')
149151
},
150152
'android e2e tests': {
151-
// temporarily disable e2e tests, they have a high transient failure rate
152-
// runCmdOnDockerImage(androidImageName, 'bash /app/ContainerShip/scripts/run-ci-e2e-tests.sh --android --js', '--rm')
153-
echo "Android E2E tests have been temporarily disabled"
153+
runCmdOnDockerImage(androidImageName, 'bash /app/ContainerShip/scripts/run-ci-e2e-tests.sh --android --js', '--privileged --rm')
154154
}
155155
)
156156
} catch(e) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"test-android-build": "docker build -t react/android -f ContainerShip/Dockerfile.android .",
119119
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
120120
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-unit-tests.sh",
121-
"test-android-run-e2e": "docker run -it react/android bash ContainerShip/scripts/run-ci-e2e-tests.sh --android --js",
121+
"test-android-run-e2e": "docker run --privileged -it react/android bash ContainerShip/scripts/run-ci-e2e-tests.sh --android --js",
122122
"test-android-all": "npm run test-android-build && npm run test-android-run-unit && npm run test-android-run-instrumentation && npm run test-android-run-e2e",
123123
"test-android-instrumentation": "npm run test-android-build && npm run test-android-run-instrumentation",
124124
"test-android-unit": "npm run test-android-build && npm run test-android-run-unit",

0 commit comments

Comments
 (0)