Skip to content

Commit b16d2c9

Browse files
committed
Implement Solr 5.x-7.x testing via Docker
Adds a docker-compose.yml, Dockerfile, and Solr configuration skeleton for testing Pysolr against Solr 5.x, 6.x, and 7.x. Testing against Solr 4.x is still implemented using the start-solr-test-server.sh script and a local download of Solr 4. Due to time constraints, this does not include tests for Pysolr's SolrCloud support for Solr 5.x+. These tests have been marked as "failure allowed" in the Travis configuration, so that they don't break build status in the short-term.
1 parent ac421dc commit b16d2c9

20 files changed

+3393
-49
lines changed

.travis.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
1-
sudo: false
1+
sudo: required
22
language: python
33
python:
4-
- "2.7"
5-
- "3.3"
6-
- "3.4"
7-
- "3.5"
8-
- "3.6"
9-
- "pypy"
4+
- "2.7"
5+
- "3.3"
6+
- "3.4"
7+
- "3.5"
8+
- "3.6"
9+
- "pypy"
1010

1111
cache:
1212
apt: true
1313
pip: true
1414
directories:
15-
- $HOME/download-cache
15+
- $HOME/download-cache
1616

1717
env:
18-
- SOLRCLOUD=false
19-
- SOLRCLOUD=true
18+
- SOLR_VERSION="4.10.4" SOLRCLOUD=false
19+
- SOLR_VERSION="4.10.4" SOLRCLOUD=true
20+
- SOLR_VERSION="5.5" SOLRCLOUD=false
21+
- SOLR_VERSION="5.5" SOLRCLOUD=true
22+
- SOLR_VERSION="6.6" SOLRCLOUD=false
23+
- SOLR_VERSION="6.6" SOLRCLOUD=true
24+
- SOLR_VERSION="7.1" SOLRCLOUD=false
25+
- SOLR_VERSION="7.1" SOLRCLOUD=true
2026

2127
matrix:
22-
allow_failures:
23-
- python: 'pypy'
28+
allow_failures:
29+
- env: SOLR_VERSION="5.5" SOLRCLOUD=true
30+
- env: SOLR_VERSION="6.6" SOLRCLOUD=true
31+
- env: SOLR_VERSION="7.1" SOLRCLOUD=false
32+
- env: SOLR_VERSION="7.1" SOLRCLOUD=true
33+
- python: 'pypy'
34+
35+
services:
36+
- docker
2437

2538
addons:
2639
apt_packages:
2740
- default-jdk
2841

42+
before_install:
43+
- sudo apt-get update
44+
- sudo apt-get install docker-ce
45+
2946
install:
30-
- "pip install 'requests>2'"
31-
- "pip install ."
32-
- 'if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then travis_retry pip install faulthandler; fi'
33-
- 'if [[ "${SOLRCLOUD:-false}" == "true" ]]; then pip install -e .[solrcloud]; fi'
47+
- "pip install 'requests>2'"
48+
- "pip install ."
49+
- 'if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]]; then travis_retry pip install faulthandler; fi'
50+
- 'if [[ "${SOLRCLOUD:-false}" == "true" ]]; then pip install -e .[solrcloud]; fi'
3451

3552
script:
36-
- python run-tests.py
53+
- python run-tests.py
3754

3855
notifications:
39-
# irc: "irc.freenode.org#pysolr"
40-
email: false
56+
# irc: "irc.freenode.org#pysolr"
57+
email: false

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '2'
2+
3+
services:
4+
solr-base:
5+
restart: "no"
6+
build:
7+
context: ./docker
8+
ports:
9+
- "8983:8983"
10+
11+
solr-5.5:
12+
extends: solr-base
13+
build:
14+
args:
15+
PY_SOLR_VERSION: 5.5
16+
17+
solr-6.6:
18+
extends: solr-base
19+
build:
20+
args:
21+
PY_SOLR_VERSION: 6.6
22+
23+
solr-7.0:
24+
extends: solr-base
25+
build:
26+
args:
27+
PY_SOLR_VERSION: 7.0
28+
29+
solr-7.1:
30+
extends: solr-base
31+
build:
32+
args:
33+
PY_SOLR_VERSION: 7.1

docker/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG PY_SOLR_VERSION
2+
FROM solr:${PY_SOLR_VERSION}
3+
4+
ARG PY_SOLR_VERSION
5+
6+
ENV CORES_DIR /opt/solr/server/solr
7+
8+
USER root
9+
COPY ./cores $CORES_DIR
10+
11+
# rewrite solrconfig.xml luceneMatchVersion to match current version and re-chown
12+
RUN perl -p -i -e "s|<luceneMatchVersion>.*</luceneMatchVersion>|<luceneMatchVersion>${SOLR_VERSION}</luceneMatchVersion>|"g ${CORES_DIR}/core0/conf/solrconfig.xml && \
13+
chown -R solr:solr $CORES_DIR
14+
15+
USER solr

docker/cores/core0/conf/currency.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
<!-- Example exchange rates file for CurrencyField type named "currency" in example schema -->
20+
21+
<currencyConfig version="1.0">
22+
<rates>
23+
<!-- Updated from http://www.exchangerate.com/ at 2011-09-27 -->
24+
<rate from="USD" to="ARS" rate="4.333871" comment="ARGENTINA Peso" />
25+
<rate from="USD" to="AUD" rate="1.025768" comment="AUSTRALIA Dollar" />
26+
<rate from="USD" to="EUR" rate="0.743676" comment="European Euro" />
27+
<rate from="USD" to="BRL" rate="1.881093" comment="BRAZIL Real" />
28+
<rate from="USD" to="CAD" rate="1.030815" comment="CANADA Dollar" />
29+
<rate from="USD" to="CLP" rate="519.0996" comment="CHILE Peso" />
30+
<rate from="USD" to="CNY" rate="6.387310" comment="CHINA Yuan" />
31+
<rate from="USD" to="CZK" rate="18.47134" comment="CZECH REP. Koruna" />
32+
<rate from="USD" to="DKK" rate="5.515436" comment="DENMARK Krone" />
33+
<rate from="USD" to="HKD" rate="7.801922" comment="HONG KONG Dollar" />
34+
<rate from="USD" to="HUF" rate="215.6169" comment="HUNGARY Forint" />
35+
<rate from="USD" to="ISK" rate="118.1280" comment="ICELAND Krona" />
36+
<rate from="USD" to="INR" rate="49.49088" comment="INDIA Rupee" />
37+
<rate from="USD" to="XDR" rate="0.641358" comment="INTNL MON. FUND SDR" />
38+
<rate from="USD" to="ILS" rate="3.709739" comment="ISRAEL Sheqel" />
39+
<rate from="USD" to="JPY" rate="76.32419" comment="JAPAN Yen" />
40+
<rate from="USD" to="KRW" rate="1169.173" comment="KOREA (SOUTH) Won" />
41+
<rate from="USD" to="KWD" rate="0.275142" comment="KUWAIT Dinar" />
42+
<rate from="USD" to="MXN" rate="13.85895" comment="MEXICO Peso" />
43+
<rate from="USD" to="NZD" rate="1.285159" comment="NEW ZEALAND Dollar" />
44+
<rate from="USD" to="NOK" rate="5.859035" comment="NORWAY Krone" />
45+
<rate from="USD" to="PKR" rate="87.57007" comment="PAKISTAN Rupee" />
46+
<rate from="USD" to="PEN" rate="2.730683" comment="PERU Sol" />
47+
<rate from="USD" to="PHP" rate="43.62039" comment="PHILIPPINES Peso" />
48+
<rate from="USD" to="PLN" rate="3.310139" comment="POLAND Zloty" />
49+
<rate from="USD" to="RON" rate="3.100932" comment="ROMANIA Leu" />
50+
<rate from="USD" to="RUB" rate="32.14663" comment="RUSSIA Ruble" />
51+
<rate from="USD" to="SAR" rate="3.750465" comment="SAUDI ARABIA Riyal" />
52+
<rate from="USD" to="SGD" rate="1.299352" comment="SINGAPORE Dollar" />
53+
<rate from="USD" to="ZAR" rate="8.329761" comment="SOUTH AFRICA Rand" />
54+
<rate from="USD" to="SEK" rate="6.883442" comment="SWEDEN Krona" />
55+
<rate from="USD" to="CHF" rate="0.906035" comment="SWITZERLAND Franc" />
56+
<rate from="USD" to="TWD" rate="30.40283" comment="TAIWAN Dollar" />
57+
<rate from="USD" to="THB" rate="30.89487" comment="THAILAND Baht" />
58+
<rate from="USD" to="AED" rate="3.672955" comment="U.A.E. Dirham" />
59+
<rate from="USD" to="UAH" rate="7.988582" comment="UKRAINE Hryvnia" />
60+
<rate from="USD" to="GBP" rate="0.647910" comment="UNITED KINGDOM Pound" />
61+
62+
<!-- Cross-rates for some common currencies -->
63+
<rate from="EUR" to="GBP" rate="0.869914" />
64+
<rate from="EUR" to="NOK" rate="7.800095" />
65+
<rate from="GBP" to="NOK" rate="8.966508" />
66+
</rates>
67+
</currencyConfig>

docker/cores/core0/conf/elevate.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
<!-- If this file is found in the config directory, it will only be
20+
loaded once at startup. If it is found in Solr's data
21+
directory, it will be re-loaded every commit.
22+
23+
See http://wiki.apache.org/solr/QueryElevationComponent for more info
24+
25+
-->
26+
<elevate>
27+
<query text="foo bar">
28+
<doc id="1" />
29+
<doc id="2" />
30+
<doc id="3" />
31+
</query>
32+
33+
<query text="ipod">
34+
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
35+
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
36+
</query>
37+
38+
</elevate>

0 commit comments

Comments
 (0)