Skip to content

Commit 202508e

Browse files
author
Emily Giurleo
committed
Copy evergreen folder from master, excluding local-kerberos
1 parent 348bedf commit 202508e

28 files changed

+1322
-310
lines changed

.evergreen/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Dockerfile
1+
/Dockerfile

.evergreen/Dockerfile.erb

Lines changed: 59 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,25 @@ server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#
1212
server_archive_basename = File.basename(server_url)
1313
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
1414

15-
toolchain_upper='f11598d091441ffc8d746aacfdc6c26741a3e629'
16-
toolchain_lower='5e46f2793e8e866f36eda2c5_20_02_14_19_18_18'
15+
toolchain_upper='717e3e0a26debdc100fecee0d093e488ee7a0219'
1716

18-
ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
17+
ruby_toolchain_url = "http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/ruby-toolchain-#{distro}-#{toolchain_upper}.tar.xz"
18+
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
1919

2020
%>
2121

2222
FROM <%= base_image %>
2323

24-
# increment to force apt-get update to run
25-
RUN echo 2
26-
2724
<% if debian? %>
2825

2926
ENV DEBIAN_FRONTEND=noninteractive
3027

31-
RUN apt-get update
32-
33-
RUN apt-get install -y curl
34-
35-
<% if preload? && distro =~ /ubuntu1204/ %>
36-
37-
# ubuntu1204 comes with python 2.7.3.
38-
# Install a more recent one from deadsnakes ppa so that pip works.
39-
RUN apt-get install -y python-software-properties
40-
# https://github.com/deadsnakes/issues/issues/53
41-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BB92C09DB82666C
42-
RUN add-apt-repository ppa:fkrull/deadsnakes-python2.7
43-
RUN apt-get update
44-
RUN apt-get install -y python2.7-dev
45-
46-
<% end %>
28+
# increment the counter to force apt-get update to run.
29+
# zsh is not required for any scripts but it is a better interactive shell
30+
# than bash.
31+
RUN echo 2 && \
32+
apt-get update && \
33+
apt-get install -y curl zsh
4734

4835
<% end %>
4936

@@ -68,10 +55,12 @@ RUN echo 2
6855

6956
# Ruby runtime dependencies: libyaml-0-2
7057
# Compiling ruby libraries: gcc make
58+
# Compiling pyhton packages: python2.7-dev
7159
# JRuby: openjdk-8-jre
72-
# Server dependencies: libsnmp30 libcurl3
60+
# Server dependencies: libsnmp30 libcurl3/libcurl4
7361
# Determining OS we are running on: lsb-release
7462
# Kerberos testing: krb5-user
63+
# Local Kerberos server: krb5-kdc krb5-admin-server
7564
# Installing mlaunch from git: git
7665
# ruby-head archive: bzip2
7766
# nio4r on JRuby: libgmp-dev
@@ -81,71 +70,96 @@ RUN echo 2
8170
# distros have pip installed (but none as of this writing have pip3)
8271
# therefore install python-pip in all configurations here.
8372

84-
# ubuntu1204, ubuntu1404 only have openjdk-7-jre
85-
<% unless %w(ubuntu1204 ubuntu1404).include?(distro) %>
73+
# ubuntu1404 only has openjdk-7-jre
74+
<% if distro !~ /ubuntu1404/ %>
8675
RUN apt-get install -y openjdk-8-jre
8776
<% end %>
88-
89-
<% if %w(ubuntu1204).include?(distro) %>
90-
RUN apt-get install -y libsnmp15
77+
78+
# ubuntu1404, ubuntu1604: libcurl3
79+
# ubuntu1804: libcurl4
80+
<% if distro =~ /ubuntu1804/ %>
81+
RUN apt-get install -y libcurl4
9182
<% else %>
92-
RUN apt-get install -y libsnmp30
83+
RUN apt-get install -y libcurl3
9384
<% end %>
9485

95-
# ubuntu1204, ubuntu1404, ubuntu1604: libcurl3
96-
RUN apt-get install -y libyaml-0-2 gcc make git lsb-release libcurl3 \
97-
krb5-user bzip2 libgmp-dev python-pip
86+
RUN apt-get install -y libsnmp30 libyaml-0-2 gcc make git lsb-release \
87+
krb5-user krb5-kdc krb5-admin-server bzip2 libgmp-dev python-pip python2.7-dev
9888

9989
<% else %>
10090

91+
# Enterprise server: net-snmp
10192
# lsb_release: redhat-lsb-core
10293
# our runner scripts: which
10394
# Ruby dependency: libyaml
10495
# compiling python packages: gcc python-devel
10596
# Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
10697
# mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
98+
# Local Kerberos server: krb5-server
99+
# JRuby: java-1.8.0-openjdk
107100
#
108101
# Note: lacking cyrus-sasl-gssapi produces a cryptic message
109102
# "SASL(-4): no mechanism available: No worthy mechs found"
110103
# https://github.com/farorm/python-ad/issues/10
111104

112-
RUN yum install -y redhat-lsb-core which git gcc python-devel libyaml \
113-
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi
105+
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
106+
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
107+
net-snmp
108+
109+
<% if distro =~ /rhel6/ %>
110+
111+
# RHEL 6 ships with Python 2.6.
112+
113+
RUN yum install -y centos-release-scl && \
114+
yum install -y python27-python python27-python-devel
115+
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
116+
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
117+
118+
<% else %>
119+
120+
RUN yum install -y python-devel
121+
122+
<% end %>
114123

115124
<% end %>
116125

117126
<% if preload? %>
118127

119128
WORKDIR /app
120129

121-
RUN curl --retry 3 -fL <%= server_download_url %> -o <%= File.basename(server_download_url) %>
122-
RUN tar xfz <%= File.basename(server_download_url) %>
123-
RUN mv mongo*/ /opt/mongodb
130+
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
131+
mv mongo*/ /opt/mongodb
124132
ENV USE_OPT_MONGODB=1
125133

126134
<% unless ruby_head? %>
127135

128-
RUN curl --retry 3 -fL <%= ruby_toolchain_url %> -o ruby-toolchain.tar.gz
129-
RUN tar -xC /opt -zf ruby-toolchain.tar.gz
130-
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH
136+
RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
137+
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
138+
USE_OPT_TOOLCHAIN=1
131139
#ENV PATH=/opt/rubies/python/3/bin:$PATH
132-
ENV USE_OPT_TOOLCHAIN=1
133140

134141
<% end %>
135142

136-
<% if distro =~ /ubuntu1204|rhel/ %>
143+
<% if distro =~ /rhel|ubuntu1604/ %>
137144

138145
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
146+
#
147+
# Ubuntu 16.04 apparently also ships a pip that does not work:
148+
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
149+
# Potentially this only affects environments with less than ideal
150+
# connectivity (or, perhaps, when python package registry is experiencing
151+
# availability issues) when pip must retry to install packages.
152+
#
139153
# rhel apparently does not package pip at all in core repoitories,
140154
# therefore install it the manual way.
155+
#
141156
# https://pip.pypa.io/en/stable/installing/
142157
RUN curl --retry 3 -fL https://bootstrap.pypa.io/get-pip.py | python
143158

144159
<% end %>
145160

146-
RUN pip --version
147-
148-
RUN pip install mtools-legacy[mlaunch]
161+
RUN pip --version && \
162+
pip install mtools-legacy[mlaunch]
149163

150164
<% end %>
151165

.evergreen/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This directory contains configuration and scripts used to run the driver's
44
test suite in Evergreen, MongoDB's continuous integration system.
55

6+
67
## Testing In Docker
78

89
It is possible to run the test suite in Docker. This executes all of the
@@ -78,6 +79,7 @@ syscalls](https://github.com/CentOS/sig-cloud-instance-images/issues/103).
7879
Note that this defeats one of the patches for the Spectre set of processor
7980
vulnerabilities.
8081

82+
8183
## Running Deployment In Docker
8284

8385
It is possible to use the Docker infrastructure provided by the test suite
@@ -101,3 +103,114 @@ To run a replica set deployment with authentication and expose its members
101103
on ports 30000 through 30002:
102104

103105
./.evergreen/test-on-docker -pm 30000 -d debian92 TOPOLOGY=replica-set AUTH=auth
106+
107+
108+
## Testing in AWS
109+
110+
The scripts described in this section assist in running the driver test suite
111+
on EC2 instances and in ECS tasks.
112+
113+
It is recommended to test via Docker on EC2 instances, as this produces
114+
shorter test cycles since all of the cleanup is handled by Docker.
115+
Docker is not usable on ECS (because ECS tasks are already running in
116+
Docker themselves), thus to test in ECS tasks it is required to use
117+
non-Docker scripts which generally rebuild more of the target instance and
118+
thus have longer test cycles.
119+
120+
### Instance Types
121+
122+
The test suite, as well as the Docker infrastructure if it is used,
123+
require a decent amount of memory to run. Starting with 2 GB generally
124+
works well, for example via the `t3a.small` instance type.
125+
126+
### Supported Operating Systems
127+
128+
Currently Debian and Ubuntu operating systems are supported. Support for
129+
other operating systems may be added in the future.
130+
131+
### `ssh-agent` Setup
132+
133+
The AWS testing scripts do not provide a way to specify the private key
134+
to use for authentication. This functionality is instead delegated to
135+
`ssh-agent`. If you do not already have it configured, you can run from
136+
your shell:
137+
138+
eval `ssh-agent`
139+
140+
This launches a `ssh-agent` instance for the shell in which you run this
141+
command. It is more efficient to run a single `ssh-agent` for the entire
142+
machine but the procedure for setting this up is outside the scope of this
143+
readme file.
144+
145+
With the agent running, add the private key corresponding to the key pair
146+
used to launch the EC2 instance you wish to use for testing:
147+
148+
ssh-add path/to/key-pair.pem
149+
150+
### Provision
151+
152+
Given an EC2 instance running a supported Debian or Ubuntu version at
153+
IP `12.34.56.78`, use the `provision-remote` command to prepare it for
154+
being used to run the driver's test suite. This command takes two arguments:
155+
the target, in the form of `username@ip`, and the type of provisioning
156+
to perform which can be `docker` or `local`. Note that the username for
157+
Debian instances is `admin` and the username for Ubuntu instances is `ubuntu`:
158+
159+
# Configure a Debian instance to run the test suite via Docker
160+
./.evergreen/provision-remote admin@12.34.56.78 docker
161+
162+
# Configure an Ubuntu instance to run the test suite without Docker
163+
./.evergreen/provision-remote ubuntu@12.34.56.78 local
164+
165+
This only needs to be done once per instance.
166+
167+
### Run Tests - Docker
168+
169+
When testing on an EC2 instance, it is recommended to run the tests via Docker
170+
In this scenario a docker image is created on the EC2 instance with appropriate
171+
configuration, then a container is run using this image which executes the
172+
test suite. All parameters supported by the Docker test script described
173+
above are supported.
174+
175+
Note that the private environment files (`.env.private*`), if any exist,
176+
are copied to the EC2 instance. This is done so that, for example, AWS auth
177+
may be tested in EC2 which generally requires private environment variables.
178+
179+
Run the `test-docker-remote` script as follows:
180+
181+
./.evergreen/test-docker-remote ubuntu@12.34.56.78 MONGODB_VERSION=4.2 -p
182+
183+
The first argument is the target on which to run the tests. All subsequent
184+
arguments are passed to the `test-on-docker` script. In this case, `test-docker-remote`
185+
will execute the following script on the target instance:
186+
187+
./.evergreen/test-on-docker MONGODB_VERSION=4.2 -p
188+
189+
All arguments that `test-on-docker` accepts are accepted by `test-docker-remote`.
190+
For example, to verify that all of the tooling is working correctly but not
191+
run any tests you could issue;
192+
193+
./.evergreen/test-on-docker -p TEST_CMD=true
194+
195+
The private environment files need to be specified explicitly, just like they
196+
need to be explicitly specified to `test-on-docker`. For example:
197+
198+
./.evergreen/test-on-docker MONGODB_VERSION=4.2 -pa .env.private
199+
200+
### Run Tests - Local
201+
202+
When testing in an ECS task, the only option is to execute the test suite
203+
locally to the task. This strategy can also be used on an EC2 instance,
204+
although this is not recommended because the test cycle is longer compared
205+
to the Docker testing strategy.
206+
207+
To run the tests in the task, use the `test-remote` script as follows:
208+
209+
./.evergreen/test-remote ubuntu@12.34.56.78 \
210+
env MONGODB_VERSION=4.4 AUTH=aws-regular .evergreen/run-tests-aws-auth.sh
211+
212+
The first argument is the target in the `username@ip` format. The script
213+
first copies the current directory to the target, then executes the remaining
214+
arguments as a shell command on the target. This example uses `env` to set
215+
environment variables that are referenced by the `.evergreen/run-tests-aws-auth.sh`
216+
script.

0 commit comments

Comments
 (0)