Skip to content

Commit

Permalink
ci: add webdav test
Browse files Browse the repository at this point in the history
  • Loading branch information
kofemann committed Oct 12, 2023
1 parent 523654c commit 9698289
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .ci/run-webdav-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh

. /init-grid-ui.sh

yum install -y -q python36-urllib3


export DFTS_SUT=https://store-door-svc.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8083



cat > propfind.py <<EOF
import sys
requestURL = sys.argv[1]
import os
x509vo = os.environ['X509_USER_PROXY']
import ssl
import urllib
import urllib.request
PROPFIND_HDR = {'User-Agent': "org.cms.SE-WebDAV", 'Depth': "1",
'Content-Type': "text/xml; charset=UTF-8"}
PROPFIND_DATA = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><d:propfin" + \
"d xmlns:d=\"DAV:\"><d:allprop/></d:propfind>"
cntxt = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
cntxt.verify_mode = ssl.CERT_REQUIRED
cntxt.verify_flags = ssl.VERIFY_DEFAULT
cntxt.check_hostname = True
CSWD_VERSION = "v2.00.01"
CSWD_CAPATH = "/etc/grid-security/certificates"
CSWD_PROPOCOL_BAD = ["SSL", "SSLv2", "SSLv3", "TLS", "TLSv1", "TLSv1.1"]
cntxt.load_verify_locations(capath=CSWD_CAPATH)
cntxt.load_cert_chain(x509vo, x509vo)
requestObj = urllib.request.Request(requestURL, data=PROPFIND_DATA.encode("utf-8"), headers=PROPFIND_HDR, method="PROPFIND")
responseObj = urllib.request.urlopen(requestObj, timeout=90, context=cntxt)
print(responseObj.status)
print(responseObj.msg)
print(responseObj.reason)
print(responseObj.code)
urlCharset = responseObj.headers.get_content_charset()
xmlData = responseObj.read().decode( urlCharset )
print(xmlData)
EOF

python3 ./propfind.py $DFTS_SUT
21 changes: 21 additions & 0 deletions .ci/webdav-wn-cvmfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Pod
metadata:
name: webdav-tester
spec:
containers:
- name: tester
image: centos:7
imagePullPolicy: IfNotPresent
command: [ "/bin/sleep", "inf"]
volumeMounts:
- name: cvmfs
mountPath: /cvmfs
# CVMFS automount volumes must be mounted with HostToContainer mount propagation.
mountPropagation: HostToContainer
volumes:
- name: cvmfs
persistentVolumeClaim:
claimName: cvmfs


12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,18 @@ gsi_xroot_tests:
- kubectl -n $K8S_NAMESPACE cp .ci/run-xroot-tests.sh xroot-tester:/run-xroot-tests.sh
- kubectl -n $K8S_NAMESPACE exec xroot-tester -- /bin/sh /run-xroot-tests.sh

webdav_with_x509_tests:
stage: testing
extends: .kubernetes_image
script:
- kubectl -n $K8S_NAMESPACE apply -f .ci/cvmfs-volume-storageclass-pvc.yaml
- kubectl -n $K8S_NAMESPACE apply -f .ci/webdav-wn-cvmfs.yaml
- while ! kubectl -n $K8S_NAMESPACE wait --for=condition=Ready pod webdav-tester; do sleep 1; done
- kubectl -n $K8S_NAMESPACE exec webdav-tester -- ls /cvmfs/grid.cern.ch/umd-c7wn-latest/etc/profile.d/setup-c7-wn-example.sh
- kubectl -n $K8S_NAMESPACE cp .ci/init-grid-ui.sh webdav-tester:/init-grid-ui.sh
- kubectl -n $K8S_NAMESPACE cp .ci/run-webdav-tests.sh webdav-tester:/run-webdav-tests.sh
- kubectl -n $K8S_NAMESPACE exec webdav-tester -- /bin/sh /run-webdav-tests.sh

pynfs_tests:
stage: testing
extends: .kubernetes_image
Expand Down

0 comments on commit 9698289

Please sign in to comment.