Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/basic-python3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
# gracefully, make them non-daemonic and use a suitable
# signalling mechanism such as an Event."
- pytest --no-cov -k 'not test_BaseType_Unicode and not test_nestedStructure and not testLockedClass'
# - pytest --no-cov src/DIRAC/Core/Security/test

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chaen In the previous Python 3 merge request I had missed this test. I tried adding it here but it fails in a non obvious way. Would you be able to take a look at some point?

(if you can you should work on top of this branch as I fixed all except one of the failures already)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you mean the Security tests ? Yes, these are nasty, because they unload some modules from memory in order to do a pyGSI/M2Crypto comparison. I think they can be simplified, and then not run anymore as a specific tests. I'll have a look !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that seems to be an M2Crypto issue. I have opened a bug report. I suspect that the problem lies in the C-API, probably some mess with str/bytes but since I have no knowledge of that, I will wait to see if there is a reaction before embarking in fixing it myself

https://gitlab.com/m2crypto/m2crypto/-/issues/287


steps:
- uses: actions/checkout@v2
Expand All @@ -36,7 +37,7 @@ jobs:
source "${CONDA}/bin/activate"
conda activate dirac-testing
set -euxo pipefail
export PYTHONPATH=${PWD%/*}
export PYTHONPATH=${PWD}/src
${{ matrix.command }}
env:
REFERENCE_BRANCH: ${{ github['base_ref'] || github['head_ref'] }}
4 changes: 2 additions & 2 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
command:
- pytest --no-cov
- pytest --no-cov Core/Security/test
- pytest --no-cov src/DIRAC/Core/Security/test
- tests/checkDocs.sh
# TODO This should cover more than just tests/CI
# Excluded codes related to sourcing files
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
source "${CONDA}/bin/activate"
conda activate dirac-testing
set -euxo pipefail
export PYTHONPATH=${PWD%/*}
export PYTHONPATH=${PWD}/src
${{ matrix.command }}
env:
REFERENCE_BRANCH: ${{ github['base_ref'] || github['head_ref'] }}
2 changes: 1 addition & 1 deletion .github/workflows/diracinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- name: run dirac-install
run: |
eval "$(conda shell.bash hook)" && conda activate python_${{ matrix.python }}
python Core/scripts/dirac-install.py -l DIRAC -r integration -t server --dirac-os -ddd
python src/DIRAC/Core/scripts/dirac-install.py -l DIRAC -r integration -t server --dirac-os -ddd
2 changes: 1 addition & 1 deletion .github/workflows/pilotWrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: |
cp tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py .
eval "$(conda shell.bash hook)" && conda activate python_${{ matrix.python }}
python Test_GenerateAndExecutePilotWrapper.py file://${{ github.workspace }}/WorkloadManagementSystem/Utilities/PilotWrapper.py file://${{ github.workspace }}/Core/scripts/dirac-install.py
python Test_GenerateAndExecutePilotWrapper.py file://${{ github.workspace }}/src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py file://${{ github.workspace }}/src/DIRAC/Core/scripts/dirac-install.py
2 changes: 1 addition & 1 deletion container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN mkdir -p /opt/dirac/DIRAC && \
# Installing DIRAC in /opt/dirac
RUN \
cd /opt/dirac && \
curl -L -o dirac-install https://raw.githubusercontent.com/DIRACGrid/DIRAC/integration/Core/scripts/dirac-install.py && \
curl -L -o dirac-install https://raw.githubusercontent.com/DIRACGrid/DIRAC/integration/src/DIRAC/Core/scripts/dirac-install.py && \
chmod +x dirac-install && \
./dirac-install -r v6r20 -t server -i 27 -g v14r1 && \
rm -rf /opt/dirac/.installCache && \
Expand Down
6 changes: 3 additions & 3 deletions docs/diracdoctools/Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ def setUpReadTheDocsEnvironment(moduleName='DIRAC'):
"""
LOG.info('Running for READTHEDOCS')
sys.path.append(os.path.abspath('.'))
diracPath = os.path.abspath(os.path.join(os.getcwd(), '../..'))
diracPath = os.path.abspath(os.path.join(os.getcwd(), '../src'))
LOG.info('Path To Module(?): %r', diracPath)

buildfolder = '_build'
mkdir(os.path.abspath('../' + buildfolder))

# We need to have the moduleName somewhere, or we cannot import it, as
# readtheDocs clones the repo into something based on the branchname
if not os.path.exists(os.path.join('../../', moduleName)):
if not os.path.exists(os.path.join('../src', moduleName)):
diracLink = os.path.abspath(os.path.join(os.getcwd(), '../', buildfolder, moduleName))
LOG.info('Link: %r', diracLink)
if not os.path.exists(diracLink):
LOG.info('Creating symbolic link %r -> %r', diracPath, diracLink)
os.symlink(diracPath, diracLink)
diracPath = os.path.abspath(os.path.join(diracLink, '..'))
diracPath = os.path.abspath(os.path.join(diracLink, 'src'))

sys.path.insert(0, diracPath)

Expand Down
2 changes: 1 addition & 1 deletion docs/docs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module_name = DIRAC

# path to the source folder relative to docs.conf
source_folder = ../
source_folder = ../src/DIRAC

[Code]
# building code reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ the user's home folder):

The output should look something like this::

--2019-04-11 08:51:21-- https://github.com/DIRACGrid/DIRAC/raw/integration/Core/scripts/dirac-install.py
--2019-04-11 08:51:21-- https://github.com/DIRACGrid/DIRAC/raw/integration/src/DIRAC/Core/scripts/dirac-install.py
Resolving github.com... 140.82.118.4, 140.82.118.3
Connecting to github.com|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ chown -R diracuser:diracuser ~diracuser/.globus/
cat > InstallDiracClient <<EOF
# START installClient1
mkdir -p ~/DiracInstallation && cd ~/DiracInstallation
curl -O -L https://github.com/DIRACGrid/DIRAC/raw/integration/Core/scripts/dirac-install.py
curl -O -L https://github.com/DIRACGrid/DIRAC/raw/integration/src/DIRAC/Core/scripts/dirac-install.py
chmod +x dirac-install.py
./dirac-install.py -r v7r0p36 --dirac-os
# END installClient1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ continue to install DIRAC `<https://github.com/DIRACGrid/DIRAC/wiki/GitSetup>`_.
#. Create a directory where you will install DIRAC and WebAppDIRAC: mkdir portal; cd portal
#. git clone git://github.com/zmathe/DIRAC.git. (NOTE: This works when you forked the DIRAC repository) or execute: git clone https://github.com/DIRACGrid/DIRAC.git
#. git clone git://github.com/zmathe/WebAppDIRAC.git (NOTE: This works when you forked the WebAppDIRAC repository on github) or git clone `<https://github.com/DIRACGrid/WebAppDIRAC.git>`_.
#. ./DIRAC/Core/scripts/dirac-install.py -r v6r21-pre1 -X -t server --dirac-os --dirac-os-version=0.0.6** (You can use the current production version of DIRAC which can found http://diracgrid.org. NOTE: The current version of dirac-os is 0.0.6 but this might change. The available versions can be found at http://lhcbproject.web.cern.ch/lhcbproject/dist/Dirac_project/installSource/.)
#. ./DIRAC/src/DIRAC/Core/scripts/dirac-install.py -r v6r21-pre1 -X -t server --dirac-os --dirac-os-version=0.0.6** (You can use the current production version of DIRAC which can found http://diracgrid.org. NOTE: The current version of dirac-os is 0.0.6 but this might change. The available versions can be found at http://lhcbproject.web.cern.ch/lhcbproject/dist/Dirac_project/installSource/.)
#. python DIRAC/Core/scripts/dirac-deploy-scripts.py
#. ./WebAppDIRAC/dirac-postInstall.py
#. source bashrc (we have to use the correct python in order to install tornado)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Install script

Download the *dirac-install* script from::

wget -np -O dirac-install https://github.com/DIRACGrid/DIRAC/raw/integration/Core/scripts/dirac-install.py --no-check-certificate
wget -np -O dirac-install https://github.com/DIRACGrid/DIRAC/raw/integration/src/DIRAC/Core/scripts/dirac-install.py --no-check-certificate
chmod +x dirac-install

Choose the directory where you want to install the DIRAC software and run the dirac-install script from
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ python_files=Test_*.py assert*.py
# The reason here is that we do nasty things with the pythonpath
# in order to make sure that M2Crypto and pyGSI do not step
# on each other's feet
addopts = -rx -v --color=yes --showlocals --tb=long --ignore=tests --ignore=Core/Security/test
addopts = -rx -v --color=yes --showlocals --tb=long --ignore=tests --ignore=src/DIRAC/Core/Security/test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def dumpChainToString(self):

:returns: S_OK(pem chain)
"""
data = ''
data = b""
for cert in self._certList:
data += cert.asPem()
return S_OK(data)
Expand Down Expand Up @@ -1060,9 +1060,9 @@ def hash(self):
return S_OK(self.__hash)
sha1 = hashlib.sha1()
for cert in self._certList:
sha1.update(str(cert.getSubjectNameObject()["Value"]))
sha1.update(str(self.getRemainingSecs()['Value'] / 3600))
sha1.update(self.getDIRACGroup()['Value'])
sha1.update(str(cert.getSubjectNameObject()["Value"]).encode())
sha1.update(str(self.getRemainingSecs()['Value'] / 3600).encode())
sha1.update(self.getDIRACGroup()['Value'].encode())
if self.isVOMS():
sha1.update(b"VOMS")
from DIRAC.Core.Security.VOMS import VOMS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_proxy(request):
# When you do the delegation, you call both Request and Proxy generation fixtures.
# So if you do the cleaning twice, you end up in a terrible mess.
# So, do not do the cleaning if you are in the test_delegation method
if request.function.func_name != 'test_delegation':
if request.function.__name__ != 'test_delegation':
deimportDIRAC()
x509Class = request.param

Expand Down Expand Up @@ -335,7 +335,7 @@ def test_dumpChainToString_on_cert(cert_file, get_X509Chain_class):

assert res['OK']

assert res['Value'] == "%s" % getCertOption(cert_file, 'content')
assert res['Value'] == getCertOption(cert_file, 'content')


@parametrize('cert_file', CERTS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
CERTKEYS = (HOSTKEY, USERKEY)

CERTCONTENTS = {
'HOSTCERTCONTENT': """-----BEGIN CERTIFICATE-----
'HOSTCERTCONTENT': b"""-----BEGIN CERTIFICATE-----
MIIGQTCCBCmgAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwVDEYMBYGA1UECgwPRElS
QUMgQ29tcHV0aW5nMTgwNgYDVQQDDC9ESVJBQyBDb21wdXRpbmcgU2lnbmluZyBD
ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xODA4MjIwOTE4MTdaFw0zNzEwMjEw
Expand Down Expand Up @@ -60,7 +60,7 @@
Hia1xkpBKOPRY0BrSGCdEUT5+ict
-----END CERTIFICATE-----
""",
'USERCERTCONTENT': """-----BEGIN CERTIFICATE-----
'USERCERTCONTENT': b"""-----BEGIN CERTIFICATE-----
MIIFszCCA5ugAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwVDEYMBYGA1UECgwPRElS
QUMgQ29tcHV0aW5nMTgwNgYDVQQDDC9ESVJBQyBDb21wdXRpbmcgU2lnbmluZyBD
ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xODA4MjIwOTE1MTRaFw0zNzEwMjEw
Expand Down Expand Up @@ -105,7 +105,7 @@
# https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem

KEYCONTENTS_PKCS8 = {
HOSTKEY: """-----BEGIN PRIVATE KEY-----
HOSTKEY: b"""-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDjV5Y6AQI61nZH
y6hjr1MziFFeh/z1DdAgkPfiUnHQLxWtvXGcc4sX/tBcD6tvNKTzJCwyFVAML0WN
TD/w480TUmGILlRtg+17qfSWfeCvDygSbGNINX+la0auEqY7u5oXtwhFAEnqBe+6
Expand Down Expand Up @@ -158,7 +158,7 @@
CrerHYr0zdgIXTt+xus9RGGmZi1mfjI=
-----END PRIVATE KEY-----
""",
USERKEY: """-----BEGIN PRIVATE KEY-----
USERKEY: b"""-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCp9md/3Ar5r6rH
yR9GUhp6HMPaLH7pMpkn7D1oGWHXVvlw9+Ygw6ZMRd7ysPkbpYqh84o0GJDi9fa0
S/umxil60zBD1HmSzrtE39gYWTMQQ7uPNgW1axLaNux0dV//bB6MgI+EAFg/WwZp
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ def test_everyBaseTypeIsTested():
We rely on the fact that the test function will be called
"test_BaseType"
"""
current_module = sys.modules[__name__]

for encodeFunc in g_dEncodeFunctions.values():
testFuncName = ('test_BaseType_%s' % encodeFunc.__name__).replace('encode', '')
getattr(current_module, testFuncName)
globals()[testFuncName]


def agnosticTestFunction(enc_dec_tuple, data):
Expand Down
Loading