Skip to content
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

Draft
wants to merge 110 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
9d1e205
DAOS-4093 test: Integrate Java and Hadoop test into DAOS CI
Puspalogan Aug 20, 2020
c8c377d
DAOS-3794 test: Add pool destroy test during rebuild with io
saurabhtandan Oct 20, 2020
42bca9c
Merge branch 'master' into DAOS-3794
saurabhtandan Oct 20, 2020
a7a9ce0
Merge branch 'master' into DAOS-4093
saurabhtandan Oct 27, 2020
01e1478
Merge branch 'master' into DAOS-4093
saurabhtandan Nov 3, 2020
8e0ae37
Merge branch 'master' into DAOS-4093
saurabhtandan Nov 3, 2020
5cb6795
Added maven package to rpms list
saurabhtandan Nov 3, 2020
873b941
Merge branch 'DAOS-4093' of github.com:daos-stack/daos into DAOS-4093
saurabhtandan Nov 3, 2020
a545001
Increased timeout limit.
saurabhtandan Nov 4, 2020
e31ba7e
Merge branch 'master' into DAOS-4093
saurabhtandan Nov 5, 2020
362a9c8
Automated java sdk version
saurabhtandan Nov 6, 2020
f7b7f25
Running maven with extra log display.
saurabhtandan Nov 6, 2020
a01dd41
Build Java jar files during setup
saurabhtandan Nov 6, 2020
250d18d
Moved java build as part of SCons script.
saurabhtandan Nov 10, 2020
a45e0f5
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Nov 23, 2020
df3701d
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Nov 30, 2020
23b7c96
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 2, 2020
4b41ac9
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 3, 2020
3c67b00
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 3, 2020
160d4e9
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 7, 2020
0ce8126
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 14, 2020
27d81c0
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Dec 18, 2020
fa09ae6
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 5, 2021
4a6ecc1
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 8, 2021
eb68fa9
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 12, 2021
4e341ee
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 15, 2021
0deed20
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 19, 2021
a1c6d22
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 21, 2021
a5ea44d
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 22, 2021
9cad4e9
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 25, 2021
ddf7710
Modified daos.spec and JenkinsFile to add daos-tests-java
saurabhtandan Jan 25, 2021
801b0d4
Merge branch 'DAOS-4093' into DAOS-4093_java_package
saurabhtandan Jan 25, 2021
aa19356
[DO NOT MERGE] DAOS-4093 test: java package and Java IT test.
saurabhtandan Jan 25, 2021
aa01dfa
Removing unwanted files
saurabhtandan Jan 25, 2021
05ba7e1
Modified daos.spec as per suggestions
saurabhtandan Jan 26, 2021
f112e37
Modified daos.spec
saurabhtandan Jan 26, 2021
ee9a86d
Modified JenkinsFile
saurabhtandan Jan 26, 2021
55c31a2
Modified daos.spec
saurabhtandan Jan 26, 2021
a36c9e6
Modified daos.spec
saurabhtandan Jan 27, 2021
946d74b
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 27, 2021
e97c2cc
Modified daos.spec
saurabhtandan Jan 27, 2021
1008d2a
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Jan 27, 2021
fdd7955
Modified ci_integration.py file
saurabhtandan Jan 28, 2021
ec6bf25
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 28, 2021
7b6f423
Modified test files
saurabhtandan Jan 29, 2021
1f079cc
Modified test file
saurabhtandan Jan 29, 2021
121aa97
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Jan 29, 2021
eeb7797
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 1, 2021
a85560e
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 2, 2021
6b42ea3
Using find_java_home.sh
saurabhtandan Feb 2, 2021
5ae9ec0
Changed test file
saurabhtandan Feb 3, 2021
92c7485
Modified test file
saurabhtandan Feb 3, 2021
f1eca1e
Modified test file
saurabhtandan Feb 3, 2021
4b24f15
Modified test file
saurabhtandan Feb 3, 2021
1ecf038
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 3, 2021
1775178
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 4, 2021
9d9f688
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 5, 2021
8470f2b
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 6, 2021
ceab242
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 8, 2021
67796bf
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 9, 2021
d1102f0
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 10, 2021
0797ea1
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 10, 2021
6f2e147
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 10, 2021
121f393
WIP
saurabhtandan Feb 11, 2021
ad9872d
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 11, 2021
f02c1d8
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 11, 2021
4dedb4e
Corrected daos.spec chronology
saurabhtandan Feb 11, 2021
95afe4f
Quick-Functional: true
saurabhtandan Feb 12, 2021
c7ff7f1
Quick-Functional: true
saurabhtandan Feb 12, 2021
cd67606
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 16, 2021
292f44b
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 16, 2021
070cb5f
Added java SConscript to build java.
saurabhtandan Feb 17, 2021
30273d1
Test-tag: javaciintegration
saurabhtandan Feb 17, 2021
de61293
Test-tag: javaciintegration
saurabhtandan Feb 17, 2021
b886b25
Test-tag: javaciintegration
saurabhtandan Feb 17, 2021
2c633e2
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Feb 17, 2021
4f92541
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Feb 17, 2021
45ac04c
WIP
saurabhtandan Mar 9, 2021
a59ffe1
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Mar 9, 2021
b34d6e2
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Mar 9, 2021
c24b7b9
Added provision for java code to build with in tree libs/headers
saurabhtandan Mar 9, 2021
b8a5c0c
Changed date in daos.spec changelog
saurabhtandan Mar 9, 2021
b8a67b1
Modified daos.spec
saurabhtandan Mar 9, 2021
011a5eb
Printing maven output in build.log
saurabhtandan Mar 9, 2021
dcdb12e
Test-tag: javaciintegration
saurabhtandan Mar 9, 2021
4862dc3
Enabled network for rpm packaging stage.
saurabhtandan Mar 10, 2021
df41832
Enabled network for rpm packaging stage.
saurabhtandan Mar 10, 2021
1e7a34b
Changed daos install path location in daos.spec
saurabhtandan Mar 10, 2021
372b426
Added hack to remove temporary part of the
saurabhtandan Mar 12, 2021
473b69e
Changed permission of java folder
saurabhtandan Mar 12, 2021
209de84
Modified daos.spec
saurabhtandan Mar 12, 2021
e519388
Modified test file.
saurabhtandan Mar 16, 2021
095965d
Modified test file.
saurabhtandan Mar 17, 2021
816706e
Modified JenkinsFile to add protobuf-c-devel
saurabhtandan Mar 18, 2021
06a09fe
Edited pom.xml
saurabhtandan Mar 19, 2021
8ff5bd3
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Mar 19, 2021
aa4574e
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Mar 19, 2021
f348740
Modified test script after some conflicts due to master merging.
saurabhtandan Mar 19, 2021
cdf7f3d
Modified daos.spec
saurabhtandan Mar 19, 2021
fb17d43
Modified daos.spec
saurabhtandan Mar 20, 2021
439827f
Modified JenkinsFile
saurabhtandan Mar 22, 2021
2448c91
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Apr 14, 2021
32682e1
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Apr 14, 2021
0490413
Modified daos.spec,find_build_paths.sh and pom.xml
saurabhtandan Apr 14, 2021
44bb7e8
Modified scan_daos_node.sh
saurabhtandan Apr 14, 2021
17aac2b
Pointed modified pipeline-lib branch with java package in JenkinsFile
saurabhtandan Apr 15, 2021
e949b1b
Restructured test files.
saurabhtandan Apr 15, 2021
0d5d55b
Modified yaml file as unwanted code got pushed.
saurabhtandan Apr 15, 2021
a837d9f
Merge branch 'master' of github.com:daos-stack/daos
saurabhtandan Apr 24, 2021
ebfe0d6
Merge branch 'master' into DAOS-4093_java_package
saurabhtandan Apr 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ String get_daos_packages() {
String get_daos_packages(String distro) {
String pkgs
if (env.TEST_RPMS == 'true') {
pkgs = "daos{,-{client,tests,server}}"
pkgs = "daos{,-{client,tests{,-java},server}}"
} else {
pkgs = "daos{,-client}"
}
Expand Down
2 changes: 2 additions & 0 deletions src/client/java/distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<descriptors>
<descriptor>src/assembly/make-assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
Expand All @@ -55,6 +56,7 @@
<descriptors>
<descriptor>src/assembly/make-assembly-with-dependencies.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
Expand Down
165 changes: 165 additions & 0 deletions src/tests/ftest/soak/ci_integration.py
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
Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator

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

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The 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)


Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this now, yes?

Suggested change
# 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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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={}".\
Copy link
Contributor

Choose a reason for hiding this comment

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

What does clean here do? Is this a target like make clean integration-test where make clean is done and then make integration-test is done? If so, isn't clean going to remove the stuff that was built, and probably try to rebuild it?

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):
Copy link
Contributor

Choose a reason for hiding this comment

The 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
21 changes: 21 additions & 0 deletions src/tests/ftest/soak/ci_integration.yaml
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
15 changes: 15 additions & 0 deletions utils/rpms/daos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you determine this is actually needed? Even without maven clean?

Requires: maven

%description tests-java
This is the package needed to run the DAOS java test suite.

%prep
%autosetup

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down