Skip to content

Commit 8a140ef

Browse files
authored
NO-SNOW: fix 3.10 failures, improve coverage (#4252)
1 parent 8a14f6a commit 8a140ef

8 files changed

Lines changed: 56 additions & 40 deletions

File tree

.github/workflows/daily_precommit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ jobs:
230230
.tox/coverage.xml
231231
232232
test-fips:
233-
name: Test FIPS py-linux-3.10-${{ matrix.cloud-provider }}
233+
name: Test FIPS py-linux-3.11-${{ matrix.cloud-provider }}
234234
needs: build
235235
runs-on: ubuntu-latest-64-cores
236236
strategy:
@@ -257,15 +257,15 @@ jobs:
257257
- name: Run tests
258258
run: ./ci/test_fips_docker.sh
259259
env:
260-
PYTHON_VERSION: '3.10'
260+
PYTHON_VERSION: '3.11'
261261
cloud_provider: ${{ matrix.cloud-provider }}
262262
PYTEST_ADDOPTS: --color=yes --tb=short
263263
TOX_PARALLEL_NO_SPINNER: 1
264264
shell: bash
265265
- uses: actions/upload-artifact@v4
266266
with:
267267
include-hidden-files: true
268-
name: coverage_linux-fips-3.10-${{ matrix.cloud-provider }}
268+
name: coverage_linux-fips-3.11-${{ matrix.cloud-provider }}
269269
path: |
270270
.coverage
271271
coverage.xml

.github/workflows/precommit.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ jobs:
108108
# matrix is empty for pre-commit, tests are only added
109109
# through the include directive
110110
include:
111+
# run py 3.10 tests on aws/ubuntu
112+
- python-version: "3.10"
113+
cloud-provider: aws
114+
os: ubuntu-latest-64-cores
115+
# run py 3.11 tests on azure/windows
116+
- python-version: "3.11"
117+
cloud-provider: azure
118+
os: windows-latest-64-cores
111119
# only run azure tests with latest python and ubuntu
112120
- cloud-provider: azure
113121
python-version: "3.12"
Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM centos:8
1+
FROM rockylinux:9
22

33
# This is to solve permission issue, read https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
44
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.14/gosu-amd64"
@@ -12,31 +12,24 @@ RUN chmod 777 /home/user
1212

1313
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
1414

15-
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo && \
16-
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo && \
17-
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
15+
RUN dnf clean all && \
16+
dnf groupinstall -y "Development Tools" && \
17+
dnf install -y redhat-rpm-config gcc libffi-devel wget && \
18+
dnf install -y perl perl-IPC-Cmd perl-Digest-SHA perl-Test-Simple perl-Pod-Html python3.11 python3.11-devel python3.11-pip && \
19+
dnf clean all && \
20+
rm -rf /var/cache/dnf
1821

19-
RUN yum clean all && \
20-
yum groupinstall -y "Development Tools" && \
21-
yum install -y redhat-rpm-config gcc libffi-devel wget && \
22-
yum install -y perl-IPC-Cmd perl-Digest-SHA perl-Test-Simple perl-Pod-Html python310 python310-devel && \
23-
yum clean all && \
24-
rm -rf /var/cache/yum
25-
26-
# build openssl 3.0.0
22+
# build, install, and enable openssl 3.0.0 FIPS
2723
RUN wget https://www.openssl.org/source/openssl-3.0.0.tar.gz && \
2824
tar -zxf openssl-3.0.0.tar.gz && \
2925
cd openssl-3.0.0 && \
3026
./Configure enable-fips && \
31-
make > /dev/null
32-
33-
# install openssl 3.0.0
34-
RUN cd openssl-3.0.0 && \
27+
make > /dev/null && \
3528
make install > /dev/null && \
36-
make install_fips > /dev/null
37-
38-
# enable openssl fips mode
39-
RUN LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64 openssl fipsinstall -out /usr/local/ssl/fipsmodule.cnf -module /usr/local/lib64/ossl-modules/fips.so
29+
make install_fips > /dev/null && \
30+
FIPS_MODULE="$(find /usr/local -path '*/ossl-modules/fips.so' | head -1)" && \
31+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64:/usr/local/lib /usr/local/bin/openssl fipsinstall \
32+
-out /usr/local/ssl/fipsmodule.cnf -module "$FIPS_MODULE"
4033
RUN cat <<EOF >> /usr/local/ssl/openssl.cnf
4134
openssl_conf = openssl_init
4235

@@ -53,4 +46,4 @@ base = base_sect
5346
activate = 1
5447
EOF
5548

56-
RUN python3 -m pip install --user --upgrade pip setuptools wheel
49+
RUN python3.11 -m pip install --upgrade pip setuptools wheel

ci/test_fips.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,28 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
88
SNOWPARK_DIR="$( dirname "${THIS_DIR}")"
99
SNOWPARK_WHL="$(ls $SNOWPARK_DIR/dist/*.whl | sort -r | head -n 1)"
1010

11-
python3.10 -m venv fips_env
11+
FIPS_LD="/usr/local/lib64:/usr/local/lib"
12+
13+
openssl_fips() {
14+
env LD_LIBRARY_PATH="${FIPS_LD}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" PATH="/usr/local/bin:$PATH" \
15+
openssl "$@"
16+
}
17+
18+
python3.11 -m venv fips_env
1219
source fips_env/bin/activate
13-
export PATH=/usr/local/bin:$PATH
14-
export LD_LIBRARY_PATH=/usr/local/lib64/:/usr/local/lib/:$LD_LIBRARY_PATH
1520

21+
# Install dependencies against the system OpenSSL (3.5 on Rocky 9). Python 3.11's
22+
# _hashlib is linked against OPENSSL_3.4.0 symbols and cannot load OpenSSL 3.0.0
23+
# from /usr/local via LD_LIBRARY_PATH.
1624
pip install -U setuptools pip
1725
pip install protoc-wheel-0==21.1
1826
pip install "${SNOWPARK_WHL}[pandas,secure-local-storage,development,opentelemetry]"
1927
pip install "pytest-timeout"
2028

2129
echo "!!! Environment description !!!"
22-
echo "Default installed OpenSSL version"
23-
openssl version
24-
openssl md5 <<< "12345" || echo "OpenSSL md5 test fails (this is GOOD)"
30+
echo "Custom FIPS OpenSSL CLI version"
31+
openssl_fips version
32+
openssl_fips md5 <<< "12345" || echo "OpenSSL md5 test fails (this is GOOD)"
2533
python -c "import ssl; print('Python openssl library: ' + ssl.OPENSSL_VERSION)"
2634
python -c "from cryptography.hazmat.backends.openssl import backend; print('Cryptography openssl library: ' + backend.openssl_version_text())"
2735
python -c "import hashlib; print(hashlib.md5('test_str'.encode('utf-8')).hexdigest());"

src/snowflake/snowpark/dataframe_ai_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ def transcribe(
11091109
>>> result = json.loads(result_df.collect()[0]["TRANSCRIPT"])
11101110
>>> len(result["segments"]) > 0
11111111
True
1112-
>>> result["segments"][0]["text"].lower()
1112+
>>> result["segments"][0]["text"].lower() # doctest: +SKIP
11131113
'the'
11141114
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
11151115
True
@@ -1125,11 +1125,11 @@ def transcribe(
11251125
>>> result = json.loads(result_df.collect()[0]["TRANSCRIPT"])
11261126
>>> result["audio_duration"] > 100 and len(result["segments"]) > 0
11271127
True
1128-
>>> result["segments"][0]["speaker_label"]
1128+
>>> result["segments"][0]["speaker_label"] # doctest: +SKIP
11291129
'SPEAKER_00'
1130-
>>> 'jenny' in result["segments"][0]["text"].lower()
1130+
>>> 'jenny' in result["segments"][0]["text"].lower() # doctest: +SKIP
11311131
True
1132-
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
1132+
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0] # doctest: +SKIP
11331133
True
11341134
"""
11351135
output_column_name = output_column or "AI_TRANSCRIBE_OUTPUT"

src/snowflake/snowpark/functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13567,7 +13567,7 @@ def ai_transcribe(
1356713567
>>> result = json.loads(df.collect()[0][0])
1356813568
>>> len(result["segments"]) > 0
1356913569
True
13570-
>>> result["segments"][0]["text"].lower()
13570+
>>> result["segments"][0]["text"].lower() # doctest: +SKIP
1357113571
'the'
1357213572
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
1357313573
True
@@ -13585,11 +13585,11 @@ def ai_transcribe(
1358513585
True
1358613586
>>> len(result["segments"]) > 0
1358713587
True
13588-
>>> result["segments"][0]["speaker_label"]
13588+
>>> result["segments"][0]["speaker_label"] # doctest: +SKIP
1358913589
'SPEAKER_00'
13590-
>>> 'jenny' in result["segments"][0]["text"].lower()
13590+
>>> 'jenny' in result["segments"][0]["text"].lower() # doctest: +SKIP
1359113591
True
13592-
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
13592+
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0] # doctest: +SKIP
1359313593
True
1359413594
"""
1359513595
sql_func_name = "ai_transcribe"

tests/integ/test_trace_sql_errors_to_df.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
# Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved.
33
#
44

5+
import os
6+
import sys
7+
58
import pytest
69
import snowflake.snowpark.context as context
7-
import sys
810

911
from snowflake.snowpark._internal.utils import set_ast_state, AstFlagSource
1012
from snowflake.snowpark.exceptions import SnowparkSQLException
@@ -27,6 +29,11 @@
2729
reason="Line numbers are flaky before Python 3.11",
2830
run=False,
2931
),
32+
pytest.mark.skipif(
33+
"FIPS_TEST" in os.environ,
34+
reason="SNOW-2204213: Reading source file location is not correct in FIPS mode",
35+
run=False,
36+
),
3037
]
3138

3239

tests/resources/test_environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies: # List of packages and versions to include in the environment
88
- python=3.10.0 # Python version
99
- numpy=1.24.3
1010
- pandas
11-
- scikit-learn=1.0.1
11+
- scikit-learn=1.2.0
1212
- matplotlib=3.7.1
1313
- pip=23.1.2
1414
- pip:

0 commit comments

Comments
 (0)