-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT MERGE] DAOS-4093 test: java package and Java IT test. #4410
base: master
Are you sure you want to change the base?
Changes from 45 commits
9d1e205
c8c377d
42bca9c
a7a9ce0
01e1478
8e0ae37
5cb6795
873b941
a545001
e31ba7e
362a9c8
f7b7f25
a01dd41
250d18d
a45e0f5
df3701d
23b7c96
4b41ac9
3c67b00
160d4e9
0ce8126
27d81c0
fa09ae6
4a6ecc1
eb68fa9
4e341ee
0deed20
a1c6d22
a5ea44d
9cad4e9
ddf7710
801b0d4
aa19356
aa01dfa
05ba7e1
f112e37
ee9a86d
55c31a2
a36c9e6
946d74b
e97c2cc
1008d2a
fdd7955
ec6bf25
7b6f423
1f079cc
121aa97
eeb7797
a85560e
6b42ea3
5ae9ec0
92c7485
f1eca1e
4b24f15
1ecf038
1775178
9d9f688
8470f2b
ceab242
67796bf
d1102f0
0797ea1
6f2e147
121f393
ad9872d
f02c1d8
4dedb4e
95afe4f
c7ff7f1
cd67606
292f44b
070cb5f
30273d1
de61293
b886b25
2c633e2
4f92541
45ac04c
a59ffe1
b34d6e2
c24b7b9
b8a5c0c
b8a67b1
011a5eb
dcdb12e
4862dc3
df41832
1e7a34b
372b426
473b69e
209de84
e519388
095965d
816706e
06a09fe
8ff5bd3
aa4574e
f348740
cdf7f3d
fb17d43
439827f
2448c91
32682e1
0490413
44bb7e8
17aac2b
e949b1b
0d5d55b
a837d9f
ebfe0d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,165 @@ | ||||||||||||||||
#!/usr/bin/python | ||||||||||||||||
""" | ||||||||||||||||
(C) Copyright 2020 Intel Corporation. | ||||||||||||||||
|
||||||||||||||||
Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||
you may not use this file except in compliance with the License. | ||||||||||||||||
You may obtain a copy of the License at | ||||||||||||||||
|
||||||||||||||||
http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||
|
||||||||||||||||
Unless required by applicable law or agreed to in writing, software | ||||||||||||||||
distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||
See the License for the specific language governing permissions and | ||||||||||||||||
limitations under the License. | ||||||||||||||||
|
||||||||||||||||
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE | ||||||||||||||||
The Government's rights to use, modify, reproduce, release, perform, display, | ||||||||||||||||
or disclose this software are subject to the terms of the Apache License as | ||||||||||||||||
provided in Contract No. B609815. | ||||||||||||||||
Any reproduction of computer software, computer software documentation, or | ||||||||||||||||
portions thereof marked with this legend must also reproduce the markings. | ||||||||||||||||
""" | ||||||||||||||||
import os | ||||||||||||||||
import re | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (pylint-unused-import) Unused import re There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (pylint-unused-import) Unused import re There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (pylint-unused-import) Unused import re There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (pylint-unused-import) Unused import re |
||||||||||||||||
from apricot import TestWithServers | ||||||||||||||||
from general_utils import pcmd | ||||||||||||||||
from command_utils import CommandFailure | ||||||||||||||||
from daos_utils import DaosCommand | ||||||||||||||||
from ClusterShell.NodeSet import NodeSet | ||||||||||||||||
from test_utils_pool import TestPool | ||||||||||||||||
from test_utils_container import TestContainer | ||||||||||||||||
from general_utils import run_task | ||||||||||||||||
|
||||||||||||||||
class JavaCIIntegration(TestWithServers): | ||||||||||||||||
"""Test class Description: | ||||||||||||||||
|
||||||||||||||||
Create a DAOS pool and container and use their | ||||||||||||||||
uuid's to run the java-hadoop integration tests | ||||||||||||||||
using maven. | ||||||||||||||||
|
||||||||||||||||
:avocado: recursive | ||||||||||||||||
""" | ||||||||||||||||
def __init__(self, *args, **kwargs): | ||||||||||||||||
"""Initialize a JavaCIIntegration object.""" | ||||||||||||||||
super(JavaCIIntegration, self).__init__(*args, **kwargs) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (pylint-super-with-arguments) Consider using Python 3 style super() without arguments |
||||||||||||||||
self.pool = None | ||||||||||||||||
self.container = None | ||||||||||||||||
|
||||||||||||||||
def _create_pool(self): | ||||||||||||||||
"""Create a TestPool object to use with ior. | ||||||||||||||||
""" | ||||||||||||||||
# Get the pool params | ||||||||||||||||
pool = TestPool( | ||||||||||||||||
self.context, dmg_command=self.get_dmg_command()) | ||||||||||||||||
pool.get_params(self) | ||||||||||||||||
# Create a pool | ||||||||||||||||
pool.create() | ||||||||||||||||
return pool | ||||||||||||||||
|
||||||||||||||||
def _create_cont(self, pool, path=None): | ||||||||||||||||
"""Create a TestContainer object to be used to create container. | ||||||||||||||||
Args: | ||||||||||||||||
pool (TestPool): pool object | ||||||||||||||||
path (str): Unified namespace path for container | ||||||||||||||||
""" | ||||||||||||||||
# Get container params | ||||||||||||||||
container = TestContainer(pool, daos_command=DaosCommand(self.bin)) | ||||||||||||||||
container.get_params(self) | ||||||||||||||||
if path is not None: | ||||||||||||||||
container.path.update(path) | ||||||||||||||||
# create container | ||||||||||||||||
container.create() | ||||||||||||||||
return container | ||||||||||||||||
|
||||||||||||||||
def java_version(self): | ||||||||||||||||
"""Check if java is installed. | ||||||||||||||||
|
||||||||||||||||
Returns: | ||||||||||||||||
bool: whether java is installed or not. | ||||||||||||||||
|
||||||||||||||||
""" | ||||||||||||||||
# checking java install | ||||||||||||||||
task = run_task(hosts=self.hostlist_clients, command="java -version") | ||||||||||||||||
for output, _ in task.iter_buffers(): | ||||||||||||||||
result = str(output) | ||||||||||||||||
self.log.info(result) | ||||||||||||||||
# looking for a string something like this 1.8.0_262-b10 | ||||||||||||||||
pattern = r"(\d+\.\d+\.\d+\_\d+\-[a-b]\d+)" | ||||||||||||||||
# replacing '_' and '-' with '.' and returning the result | ||||||||||||||||
return re.search(pattern, | ||||||||||||||||
result).groups()[0].replace("_", ".").replace("-", ".") | ||||||||||||||||
|
||||||||||||||||
def test_java_hadoop_it(self): | ||||||||||||||||
"""Jira ID: DAOS-4093 | ||||||||||||||||
|
||||||||||||||||
Test Description: | ||||||||||||||||
Create a DAOS pool and container and use their | ||||||||||||||||
uuid's to run the java-hadoop integration tests | ||||||||||||||||
using maven. | ||||||||||||||||
|
||||||||||||||||
:avocado: tags=all,pr,hw,small,javaciintegration | ||||||||||||||||
""" | ||||||||||||||||
# create pool and container | ||||||||||||||||
self.pool = self._create_pool() | ||||||||||||||||
self.container = self._create_cont(self.pool) | ||||||||||||||||
|
||||||||||||||||
pool_uuid = self.pool.uuid | ||||||||||||||||
cont_uuid = self.container.uuid | ||||||||||||||||
|
||||||||||||||||
# obtain java version | ||||||||||||||||
version = self.java_version() | ||||||||||||||||
|
||||||||||||||||
# generate jar files | ||||||||||||||||
# jdir = "{}/lib64/java".format(self.prefix) | ||||||||||||||||
# cmd = "cd {};".format(jdir) | ||||||||||||||||
# cmd += "mvn -X clean install -DskipITs -Ddaos.install.path={}".\ | ||||||||||||||||
# format(self.prefix) | ||||||||||||||||
# cmd += " >> {}/maven_jar_generation_output.log".format(self.log_dir) | ||||||||||||||||
# self.execute_cmd(cmd, 180) | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this now, yes?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just left it for initial iterations of testing. Will clean it all once I have a running test with proper infrastructure ready to use. |
||||||||||||||||
# run intergration-test | ||||||||||||||||
openjdk = "/usr/lib/jvm/java-{}-openjdk-{}-0.el7_9.x86_64/jre/lib/amd64/libjsig.so".format(version[:-8], version) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I can appreciate that this might just be a stepping stone, to get the basics of the test working, this demonstrates how fragile hard-coding version bits is going to be. Ultimately this is going to need to be determined dynamically/automatically. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you have Java installed via package manager, like yum or apt, you may try https://github.com/daos-stack/daos/blob/master/src/client/java/daos-java/find_java_home.sh to find Java home. Then use, /jre/lib/adm64/libjsig.so. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I was just taking my chances while I was working on other things. But yeah it seems like this need to be completely dynamic. |
||||||||||||||||
jdir = "{}/../java".format(os.getcwd()) | ||||||||||||||||
cmd = "cd {};".format(jdir) | ||||||||||||||||
cmd += " ls -l {};".format(openjdk) | ||||||||||||||||
cmd += " export LD_PRELOAD={};".format(openjdk) | ||||||||||||||||
# cmd += " export LD_PRELOAD=/usr/lib/jvm/" | ||||||||||||||||
# cmd += "java-{}-openjdk-{}-0.el7_8.x86_64/".format(version[:-8], | ||||||||||||||||
# version) | ||||||||||||||||
# cmd += "jre/lib/amd64/libjsig.so;" | ||||||||||||||||
cmd += " mvn -X clean integration-test -Ddaos.install.path={}".\ | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does |
||||||||||||||||
format(self.prefix) | ||||||||||||||||
cmd += " -Dpool_id={} -Dcont_id={} ".format(pool_uuid, cont_uuid) | ||||||||||||||||
cmd += " >> {}/maven_integration_test_output.log".format(self.log_dir) | ||||||||||||||||
print("***{}".format(cmd)) | ||||||||||||||||
self.execute_cmd(cmd, 300) | ||||||||||||||||
|
||||||||||||||||
def execute_cmd(self, cmd, timeout): | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely this is implemented somewhere else as a general utility function, yes? |
||||||||||||||||
"""Execute command on the host clients | ||||||||||||||||
Args: | ||||||||||||||||
cmd (str): Command to run | ||||||||||||||||
""" | ||||||||||||||||
|
||||||||||||||||
try: | ||||||||||||||||
# execute bash cmds | ||||||||||||||||
ret = pcmd( | ||||||||||||||||
self.hostlist_clients, cmd, verbose=True, timeout=timeout) | ||||||||||||||||
if 0 not in ret: | ||||||||||||||||
error_hosts = NodeSet( | ||||||||||||||||
",".join( | ||||||||||||||||
[str(node_set) for code, node_set in | ||||||||||||||||
ret.items() if code != 0])) | ||||||||||||||||
raise CommandFailure( | ||||||||||||||||
"Error running '{}' on the following " | ||||||||||||||||
"hosts: {}".format(cmd, error_hosts)) | ||||||||||||||||
|
||||||||||||||||
# report error if any command fails | ||||||||||||||||
except CommandFailure as error: | ||||||||||||||||
self.log.error("JavaCIIntegration Test Failed: %s", | ||||||||||||||||
str(error)) | ||||||||||||||||
self.fail("Test was expected to pass but " | ||||||||||||||||
"it failed.\n") | ||||||||||||||||
return ret |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
hosts: | ||
test_servers: | ||
- server-A | ||
test_clients: | ||
- client-B | ||
timeout: 600 | ||
server_config: | ||
name: daos_server | ||
servers: | ||
log_mask: INFO | ||
scm_class: dcpm | ||
scm_list: ["/dev/pmem0"] | ||
pool: | ||
mode: 146 # 146 is RW | ||
name: daos_server | ||
scm_size: 10000000000 | ||
svcn: 1 | ||
control_method: dmg | ||
container: | ||
type: POSIX | ||
control_method: daos |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,14 @@ Summary: The DAOS development libraries and headers | |
%description devel | ||
This is the package needed to build software with the DAOS library. | ||
|
||
%package tests-java | ||
Summary: The DAOS Java test suite | ||
Requires: %{name}-devel = %{version}-%{release} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you determine this is actually needed? Even without |
||
Requires: maven | ||
|
||
%description tests-java | ||
This is the package needed to run the DAOS java test suite. | ||
|
||
%prep | ||
%autosetup | ||
|
||
|
@@ -236,6 +244,7 @@ install -m 644 utils/systemd/%{server_svc_name} %{?buildroot}/%{_unitdir} | |
install -m 644 utils/systemd/%{agent_svc_name} %{?buildroot}/%{_unitdir} | ||
mkdir -p %{?buildroot}/%{conf_dir}/certs/clients | ||
mv %{?buildroot}/%{_prefix}/etc/bash_completion.d %{?buildroot}/%{_sysconfdir} | ||
cp -r src/client/java %{?buildroot}/%{_prefix}/lib/daos/TESTING/ | ||
|
||
%pre server | ||
getent group daos_metrics >/dev/null || groupadd -r daos_metrics | ||
|
@@ -403,12 +412,18 @@ getent passwd daos_agent >/dev/null || useradd -s /sbin/nologin -r -g daos_agent | |
%{_prefix}/lib/daos/.build_vars.json | ||
%{_prefix}/lib/daos/.build_vars.sh | ||
|
||
%files tests-java | ||
%{_prefix}/lib/daos/TESTING/java | ||
|
||
%files devel | ||
%{_includedir}/* | ||
%{_libdir}/libdaos.so | ||
%{_libdir}/*.a | ||
|
||
%changelog | ||
* Tue Jan 26 2021 Saurabh Tandan <[email protected]> 1.1.2.1-7 | ||
- Add daos-tests-java package | ||
|
||
* Sat Jan 23 2021 Alexander Oganezov <[email protected]> 1.1.2.1-6 | ||
- Update to mercury v2.0.1rc1 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(pylint-unused-import) Unused import re