Towards python-centric repo

This patch moves much of the Java build stuff from the topmost build.xml file
that woulds eventually get replaced with setup.py

In addition we push down the java storlets tests and implementation
down the tree, to comply with the python structure. During
merge with python code, added intermediate test classes
one for Python and one for Java that hide some details

Finally, we cleanup some old unused files under tests

Bonus:
 - Fix the Ansible behind "ant deploy_container_agent"
 - Fix what seems to be a bug in the daemog factory
   that considers ECHILD as unknown error

Change-Id: Ib503b529719e6a877fd0b1df24597f47cf471192
This commit is contained in:
Eran Rom
2016-09-05 15:19:46 +03:00
parent 43511a27c2
commit 378a06195d
48 changed files with 345 additions and 387 deletions

4
.gitignore vendored
View File

@@ -33,6 +33,10 @@ cluster_config.json
# auto created on build
Engine/dependencies/
Engine/SBus/SBusJavaFacade/org_openstack_storlet_sbus_SBusJNI.h
# Storlets build
bin
# Unit test / coverage reports
.coverage

View File

@@ -330,7 +330,12 @@ class DaemonFactory(object):
self.logger.debug('Storlet {0}, PID = {1}, ErrCode = {2}'.
format(storlet_name, str(pid), str(rc)))
except OSError as err:
if err.errno == errno.ESRCH:
# If the storlet daemon crashed
# we may get here ECHILD for which
# we want to return False
if err.errno == errno.ECHILD:
return False
elif err.errno == errno.ESRCH:
return False
elif err.errno == errno.EPERM:
raise SDaemonError(

64
Engine/build.xml Normal file
View File

@@ -0,0 +1,64 @@
<!--
Copyright IBM Corp. 2015, 2015 All Rights Reserved
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.
-->
<project>
<!-- Bring build Dependencies-->
<target name="dependencies" >
<mkdir dir="dependencies" />
<get src="http://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json_simple-1.1.jar"
dest="dependencies/json_simple-1.1.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar"
dest="dependencies/logback-classic-1.1.2.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar"
dest="dependencies/logback-core-1.1.2.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar"
dest="dependencies/slf4j-api-1.7.7.jar"
verbose="true"
usetimestamp="true"/>
<copy file="../install/storlets/roles/docker_storlet_engine_image/files/logback.xml"
tofile="dependencies/logback.xml"/>
</target>
<!-- Storlets Engine build -->
<!-- TODO(eranr): Get rid of the build.xml in Engine/agent, Engine/swift -->
<!-- TODO(eranr): Push this build.xml to the java subdirs -->
<macrodef name="iterate_engine">
<attribute name="target" />
<sequential>
<subant target="@{target}">
<fileset dir="SBus/SBusTransportLayer" includes="build.xml" />
<fileset dir="SBus/SBusJavaFacade" includes="build.xml" />
<fileset dir="SBus/SBusPythonFacade" includes="build.xml" />
<fileset dir="SCommon" includes="build.xml" />
<fileset dir="SDaemon" includes="build.xml" />
<fileset dir="SMScripts" includes="build.xml" />
<fileset dir="agent" includes="build.xml" />
<fileset dir="swift" includes="build.xml" />
</subant>
</sequential>
</macrodef>
<target name="build" depends="dependencies">
<iterate_engine target="build" />
</target>
<target name="clean">
<iterate_engine target="clean" />
<delete dir="dependencies" />
</target>
</project>

View File

@@ -14,24 +14,20 @@
-->
<project>
<target name="clean">
<delete dir="bin" />
</target>
<target name="java">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin"
classpath="../../Engine/SCommon/bin/SCommon.jar"
classpath="../../../Engine/SCommon/bin/SCommon.jar"
includeantruntime="false" />
</target>
<target name="text">
<exec dir="bin" executable="wget">
<arg line="https://github.com/openstack/storlets -O input.txt" />
</exec>
</target>
<target name="jar" depends="java">
<jar destfile="compressstorlet-1.0.jar" basedir="bin">
<manifest>
@@ -41,7 +37,6 @@
</jar>
<move file="compressstorlet-1.0.jar" todir="bin" />
</target>
<target name="build" depends="clean, jar, text">
</target>
</project>

View File

@@ -20,7 +20,7 @@
<target name="java">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin"
classpath="../../Engine/SCommon/bin/SCommon.jar"
classpath="../../../Engine/SCommon/bin/SCommon.jar"
includeantruntime="false" />
</target>
<target name="csrc" depends="jar">

View File

@@ -14,18 +14,15 @@
-->
<project>
<target name="clean">
<delete dir="bin" />
</target>
<target name="java">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin"
classpath="../../Engine/SCommon/bin/SCommon.jar"
classpath="../../../Engine/SCommon/bin/SCommon.jar"
includeantruntime="false" />
</target>
<target name="jar" depends="java">
<jar destfile="halfstorlet-1.0.jar" basedir="bin">
<manifest>
@@ -35,8 +32,7 @@
</jar>
<move file="halfstorlet-1.0.jar" todir="bin" />
</target>
<target name="text" depends="jar">
<target name="text" depends="jar">
<echo message="abcdefghijklmonp" file="bin/source.txt" />
</target>

View File

@@ -14,7 +14,6 @@
-->
<project>
<target name="clean">
<delete dir="bin" />
</target>
@@ -22,14 +21,14 @@
<target name="java">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin"
classpath="../../Engine/SCommon/bin/SCommon.jar"
classpath="../../../Engine/SCommon/bin/SCommon.jar"
includeantruntime="false" />
</target>
<target name="csrc" depends="jar">
<echo message="int main(){return 42;}" file="bin/get42.c" />
</target>
<target name="exe" depends="csrc">
<exec dir="." executable="gcc">
<arg line="-o bin/get42 " />

View File

@@ -23,7 +23,7 @@
<target name="java">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin"
classpath="../../Engine/SCommon/bin/SCommon.jar"
classpath="../../../Engine/SCommon/bin/SCommon.jar"
includeantruntime="false" />
</target>

View File

@@ -21,14 +21,13 @@
<javac srcdir="src/org/openstack/storlet/testmetadatastorlet" destdir="bin" includeantruntime="false">
<classpath>
<pathelement
path="../../Engine/SCommon/bin/SCommon.jar"/>
path="../../../Engine/SCommon/bin/SCommon.jar"/>
</classpath>
</javac>
<jar destfile="bin/testmetadatastorlet-1.0.jar"
basedir="bin"
includes="org/openstack/storlet/testmetadatastorlet/*">
</jar>
<jar destfile="bin/testmetadatastorlet-1.0.jar"
basedir="bin"
includes="org/openstack/storlet/testmetadatastorlet/*">
</jar>
</target>
<target name="text">
<echo message="Some content to copy" file="bin/source.txt" />

View File

@@ -21,7 +21,7 @@
<javac srcdir="src/org/openstack/storlet/test" destdir="bin" includeantruntime="false">
<classpath>
<pathelement
path="../../Engine/SCommon/bin/SCommon.jar"/>
path="../../../Engine/SCommon/bin/SCommon.jar"/>
</classpath>
</javac>
<jar destfile="bin/test-10.jar"

View File

@@ -14,7 +14,6 @@
-->
<project>
<target name="clean">
<delete dir="bin" />
</target>
@@ -23,7 +22,7 @@
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin" includeantruntime="false">
<classpath>
<pathelement path="../../Engine/SCommon/bin/SCommon.jar"/>
<pathelement path="../../../Engine/SCommon/bin/SCommon.jar"/>
</classpath>
</javac>
</target>

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -0,0 +1,42 @@
<!--
Copyright IBM Corp. 2015, 2015 All Rights Reserved
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.
-->
<project>
<!-- Storlets Samples build -->
<macrodef name="iterate_storlets">
<attribute name="target" />
<sequential>
<subant target="@{target}">
<fileset dir="TestStorlet" includes="build.xml" />
<fileset dir="ExecDepStorlet" includes="build.xml" />
<fileset dir="IdentityStorlet" includes="build.xml" />
<fileset dir="PartitionsIdentityStorlet" includes="build.xml" />
<fileset dir="TestMetadataStorlet" includes="build.xml" />
<fileset dir="HalfStorlet" includes="build.xml" />
<fileset dir="CompressStorlet" includes="build.xml" />
<fileset dir="ThumbnailStorlet" includes="build.xml" />
</subant>
</sequential>
</macrodef>
<target name="build">
<iterate_storlets target="build" />
</target>
<target name="clean">
<iterate_storlets target="clean" />
</target>
</project>

View File

@@ -1,5 +1,6 @@
<!--
Copyright IBM Corp. 2015, 2015 All Rights Reserved
<!--
Copyright org.apache.openstack
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
@@ -14,88 +15,30 @@
-->
<project>
<!-- Bring build Dependencies-->
<target name="dependencies" >
<mkdir dir="Engine/dependencies" />
<get src="http://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json_simple-1.1.jar"
dest="Engine/dependencies/json_simple-1.1.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar"
dest="Engine/dependencies/logback-classic-1.1.2.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar"
dest="Engine/dependencies/logback-core-1.1.2.jar"
verbose="true"
usetimestamp="true"/>
<get src="http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar"
dest="Engine/dependencies/slf4j-api-1.7.7.jar"
verbose="true"
usetimestamp="true"/>
<copy file="install/storlets/roles/docker_storlet_engine_image/files/logback.xml"
tofile="Engine/dependencies/logback.xml"/>
</target>
<!-- Storlets Engine build -->
<macrodef name="iterate_engine">
<attribute name="target" />
<sequential>
<subant target="@{target}">
<fileset dir="Engine/SBus/SBusTransportLayer" includes="build.xml" />
<fileset dir="Engine/SBus/SBusJavaFacade" includes="build.xml" />
<fileset dir="Engine/SBus/SBusPythonFacade" includes="build.xml" />
<fileset dir="Engine/SCommon" includes="build.xml" />
<fileset dir="Engine/SDaemon" includes="build.xml" />
<fileset dir="Engine/SMScripts" includes="build.xml" />
<fileset dir="Engine/agent" includes="build.xml" />
<fileset dir="Engine/swift" includes="build.xml" />
</subant>
</sequential>
</macrodef>
<target name="build_engine" depends="dependencies">
<iterate_engine target="build" />
<!-- Storlets Engine build /-->
<target name="build_engine">
<ant dir="Engine" target="build" />
</target>
<target name="clean_engine">
<iterate_engine target="clean" />
<delete dir="Engine/dependencies" />
<ant dir="Engine" target="clean" />
</target>
<!-- Storlets Engine build /-->
<!-- Storlets Samples build -->
<macrodef name="iterate_storlets">
<attribute name="target" />
<sequential>
<subant target="@{target}">
<fileset dir="StorletSamples/TestStorlet" includes="build.xml" />
<fileset dir="StorletSamples/ExecDepStorlet" includes="build.xml" />
<fileset dir="StorletSamples/IdentityStorlet" includes="build.xml" />
<fileset dir="StorletSamples/PartitionsIdentityStorlet" includes="build.xml" />
<fileset dir="StorletSamples/TestMetadataStorlet" includes="build.xml" />
<fileset dir="StorletSamples/HalfStorlet" includes="build.xml" />
<fileset dir="StorletSamples/CompressStorlet" includes="build.xml" />
<fileset dir="StorletSamples/ThumbnailStorlet" includes="build.xml" />
</subant>
</sequential>
</macrodef>
<target name="build_storlets">
<iterate_storlets target="build" />
<ant dir="StorletSamples/java" target="build" />
</target>
<target name="clean_storlets">
<iterate_storlets target="clean" />
<ant dir="StorletSamples/java" target="clean" />
</target>
<!-- Overall build -->
<target name="build" depends="build_engine, build_storlets" />
<target name="clean" depends="clean_engine, clean_storlets">
<delete dir="bin" />
</target>
<!-- Storlets Samples build /-->
<!-- Deploy -->
<!-- To execute the below tasks you must have:
(1) ansible installed

View File

@@ -105,7 +105,7 @@
args:
chdir: "/data/registry/repositories/default_tenant_image"
register: command_result
failed_when: "'sha256:' not in command_result.stdout"
failed_when: "'Successfully built' not in command_result.stdout"
- name: Push the default_tenant_image into the repository
command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}"

View File

@@ -39,7 +39,7 @@
url: "{{ item }}"
dest: /data/registry/repositories/ubuntu_14.04_jre8
with_items:
- https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json_simple-1.1.jar
- http://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json_simple-1.1.jar
- http://www.slf4j.org/dist/slf4j-1.7.7.tar.gz
- http://logback.qos.ch/dist/logback-1.1.2.tar.gz

View File

@@ -24,7 +24,7 @@ RUN apt-get update && \
apt-get install software-properties-common -y && \
add-apt-repository ppa:openjdk-r/ppa -y && \
apt-get update && \
apt-get install openjdk-8-jre -y && \
apt-get install openjdk-8-jre-headless -y && \
apt-get clean
COPY logback-classic-1.1.2.jar /opt/storlets/

View File

@@ -1,17 +1,18 @@
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 All Rights Reserved
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.
-------------------------------------------------------------------------'''
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# Copyright (c) 2010-2016 OpenStack Foundation
#
# 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.
import unittest
from tools.cluster_config_parser import ClusterConfig
@@ -21,15 +22,12 @@ from swiftclient import client as swiftclient
CONFIG_FILE = '../../cluster_config.json'
PATH_TO_STORLETS = '../../StorletSamples'
BIN_DIR = 'bin'
class StorletBaseFunctionalTest(unittest.TestCase):
def setUp(self):
self.conf_file = CONFIG_FILE
self.conf = ClusterConfig(CONFIG_FILE)
self.path_to_storlets = PATH_TO_STORLETS
self.bin_dir = BIN_DIR
super(StorletBaseFunctionalTest, self).setUp()
@@ -43,20 +41,26 @@ class StorletFunctionalTest(StorletBaseFunctionalTest):
status = response.get('status')
assert (status >= 200 or status < 300)
def setUp(self, language='Java'):
def setUp(self, language, path_to_bundle,
storlet_dir,
storlet_name, storlet_main,
container, storlet_file,
dep_names, headers):
super(StorletFunctionalTest, self).setUp()
self.storlet_dir = storlet_dir
self.storlet_name = storlet_name
self.storlet_main = storlet_main
self.dep_names = dep_names
self.path_to_bundle = path_to_bundle
self.container = container
self.storlet_file = storlet_file
self.headers = headers or {}
self.url, self.token = get_auth(self.conf)
self.acct = self.url.split('/')[4]
if language == 'Java':
self.path_to_bundle = '%s/%s/%s' % (PATH_TO_STORLETS,
self.storlet_dir,
BIN_DIR)
else:
self.path_to_bundle = '%s/%s' % (PATH_TO_STORLETS,
self.storlet_dir)
self.deps = []
for d in self.dep_names:
self.deps.append('%s/%s' % (self.path_to_bundle, d))
if dep_names:
for d in self.dep_names:
self.deps.append('%s/%s' % (self.path_to_bundle, d))
storlet = '%s/%s' % (self.path_to_bundle, self.storlet_name)
deploy_storlet(self.url, self.token,

View File

@@ -0,0 +1,36 @@
# Copyright (c) 2010-2016 OpenStack Foundation
#
# 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.
import os
from tests.functional import StorletFunctionalTest, PATH_TO_STORLETS
BIN_DIR = 'bin'
class StorletJavaFunctionalTest(StorletFunctionalTest):
def setUp(self, storlet_dir, storlet_name, storlet_main,
container, storlet_file, dep_names=None, headers=None):
storlet_dir = os.path.join('java', storlet_dir)
path_to_bundle = os.path.join(PATH_TO_STORLETS, storlet_dir,
BIN_DIR)
super(StorletJavaFunctionalTest, self).setUp('Java',
path_to_bundle,
storlet_dir,
storlet_name,
storlet_main,
container,
storlet_file,
dep_names,
headers)

View File

@@ -19,7 +19,7 @@ import random
import string
from swiftclient import client as c
from nose.plugins.attrib import attr
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
def create_local_chunks():
@@ -44,18 +44,15 @@ def create_container(url, token, name):
assert (status >= 200 or status < 300)
class TestSLO(StorletFunctionalTest):
class TestSLO(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'IdentityStorlet'
self.storlet_name = 'identitystorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.identity.IdentityStorlet'
self.storlet_log = 'identitystorlet-1.0.log'
self.headers = None
self.storlet_file = ''
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
super(TestSLO, self).setUp()
main_class = 'org.openstack.storlet.identity.IdentityStorlet'
super(TestSLO, self).setUp('IdentityStorlet',
'identitystorlet-1.0.jar',
main_class,
'myobjects', '')
create_container(self.url, self.token, 'container1')
create_container(self.url, self.token, 'container2')

View File

@@ -15,7 +15,7 @@ Limitations under the License.
----------------------------------------------------------------'''
from swiftclient import client as swift_client
from __init__ import StorletBaseFunctionalTest
from tests.functional import StorletBaseFunctionalTest
class TestCapabilities(StorletBaseFunctionalTest):

View File

@@ -14,28 +14,26 @@ Limitations under the License.
-------------------------------------------------------------------------'''
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class TestCompressStorlet(StorletFunctionalTest):
class TestCompressStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'CompressStorlet'
self.storlet_name = 'compressstorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.compress.CompressStorlet'
self.storlet_log = ''
self.headers = {}
self.storlet_file = 'input.txt'
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
super(TestCompressStorlet, self).setUp()
main_class = 'org.openstack.storlet.compress.CompressStorlet'
super(TestCompressStorlet, self).setUp('CompressStorlet',
'compressstorlet-1.0.jar',
main_class,
'myobjects',
'input.txt')
def test_put(self):
headers = {'X-Run-Storlet': self.storlet_name}
headers.update(self.additional_headers)
querystring = "action=compress"
with open('../../StorletSamples/CompressStorlet/bin/input.txt',
with open('../../StorletSamples/java/CompressStorlet/bin/input.txt',
'r') as myfile:
data = myfile.read()

View File

@@ -14,16 +14,17 @@ Limitations under the License.
-------------------------------------------------------------------------'''
import pexpect
from __init__ import StorletBaseFunctionalTest
from tests.functional import StorletBaseFunctionalTest, PATH_TO_STORLETS
from tests.functional.java import BIN_DIR
class TestExecDepStorlet(StorletBaseFunctionalTest):
def setUp(self):
super(TestExecDepStorlet, self).setUp()
self.deploy_storlet_path = '../../tools/deploy_storlet.py'
self.execdep_storlet_path = '%s/%s/%s' % (self.path_to_storlets,
'ExecDepStorlet',
self.bin_dir)
self.execdep_storlet_path = '%s/java/%s/%s' % (PATH_TO_STORLETS,
'ExecDepStorlet',
BIN_DIR)
self.execdep_storlet_jar_file = '%s/%s' % (self.execdep_storlet_path,
'execdepstorlet-1.0.jar')
self.execdep_storlet_dep_file = '%s/%s' % (self.execdep_storlet_path,

View File

@@ -14,21 +14,20 @@ Limitations under the License.
-------------------------------------------------------------------------'''
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class TestExecDepStorlet(StorletFunctionalTest):
class TestExecDepStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'ExecDepStorlet'
self.storlet_name = 'execdepstorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.execdep.ExecDepStorlet'
self.storlet_log = 'execdepstorlet-1.0.log'
self.headers = None
self.storlet_file = 'junk.txt'
self.container = 'myobjects'
self.dep_names = ['get42']
self.additional_headers = {}
super(TestExecDepStorlet, self).setUp()
main_class = 'org.openstack.storlet.execdep.ExecDepStorlet'
super(TestExecDepStorlet, self).setUp('ExecDepStorlet',
'execdepstorlet-1.0.jar',
main_class,
'myobjects',
'junk.txt',
['get42'])
def test_execdep(self):
headers = {'X-Run-Storlet': self.storlet_name}

View File

@@ -16,21 +16,21 @@ Limitations under the License.
import random
import string
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class TestHalfIdentityStorlet(StorletFunctionalTest):
class TestHalfIdentityStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'HalfStorlet'
self.storlet_name = 'halfstorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.half.HalfStorlet'
self.storlet_log = ''
self.headers = {'X-Object-Meta-Testkey': 'tester'}
self.storlet_file = 'source.txt'
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
super(TestHalfIdentityStorlet, self).setUp()
headers = {'X-Object-Meta-Testkey': 'tester'}
main_class = 'org.openstack.storlet.half.HalfStorlet'
super(TestHalfIdentityStorlet, self).setUp('HalfStorlet',
'halfstorlet-1.0.jar',
main_class,
'myobjects',
'source.txt',
headers=headers)
def invoke_storlet(self, op, params=None, global_params=None,
headers=None):

View File

@@ -19,21 +19,22 @@ import string
from swiftclient import client as c
from nose.plugins.attrib import attr
from contextlib import contextmanager
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class TestIdentityStorlet(StorletFunctionalTest):
class TestIdentityStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'IdentityStorlet'
self.storlet_name = 'identitystorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.identity.IdentityStorlet'
self.storlet_log = 'identitystorlet-1.0.log'
self.headers = {'X-Object-Meta-Testkey': 'tester'}
self.storlet_file = 'source.txt'
self.container = 'myobjects'
self.dep_names = ['get42']
self.additional_headers = {}
super(TestIdentityStorlet, self).setUp()
main_class = 'org.openstack.storlet.identity.IdentityStorlet'
headers = {'X-Object-Meta-Testkey': 'tester'}
super(TestIdentityStorlet, self).setUp('IdentityStorlet',
'identitystorlet-1.0.jar',
main_class,
'myobjects',
'source.txt',
['get42'],
headers)
def invoke_storlet(self, op, params=None, global_params=None,
header_parameters=False):

View File

@@ -14,31 +14,31 @@ Limitations under the License.
----------------------------------------------------------------'''
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class TestMetadataStorlet(StorletFunctionalTest):
class TestMetadataStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'TestMetadataStorlet'
self.storlet_name = 'testmetadatastorlet-1.0.jar'
self.storlet_main = ('org.openstack.storlet.testmetadatastorlet'
'.MetadataStorlet')
self.storlet_log = 'testmetadatastorlet-1.0.log'
self.headers = {'X-Object-Meta-key1': '1',
'X-Object-Meta-key2': '2',
'X-Object-Meta-key3': '3',
'X-Object-Meta-key4': '4',
'X-Object-Meta-key5': '5',
'X-Object-Meta-key6': '6',
'X-Object-Meta-key7': '7',
'X-Object-Meta-key8': '8',
'X-Object-Meta-key9': '9',
'X-Object-Meta-key10': '10'}
self.storlet_file = 'source.txt'
self.container = 'myobjects'
self.dep_names = []
headers = {'X-Object-Meta-key1': '1',
'X-Object-Meta-key2': '2',
'X-Object-Meta-key3': '3',
'X-Object-Meta-key4': '4',
'X-Object-Meta-key5': '5',
'X-Object-Meta-key6': '6',
'X-Object-Meta-key7': '7',
'X-Object-Meta-key8': '8',
'X-Object-Meta-key9': '9',
'X-Object-Meta-key10': '10'}
self.additional_headers = {}
super(TestMetadataStorlet, self).setUp()
main_class = ('org.openstack.storlet.testmetadatastorlet'
'.MetadataStorlet')
super(TestMetadataStorlet, self).setUp('TestMetadataStorlet',
'testmetadatastorlet-1.0.jar',
main_class,
'myobjects',
'source.txt',
headers=headers)
def test_metadata_get(self, params=None, global_params=None):
if params is not None:

View File

@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
# Below is the records.txt file we are testing with
# position line content
@@ -50,18 +50,17 @@ random text 10000\n\
random text 1\n"
class TestPartitionsIdentityStorlet(StorletFunctionalTest):
class TestPartitionsIdentityStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'PartitionsIdentityStorlet'
self.storlet_name = 'partitionsidentitystorlet-1.0.jar'
self.storlet_main = 'org.openstack.storlet.PartitionsIdentityStorlet'
self.storlet_log = 'partitionsidentitystorlet-1.0.log'
self.storlet_file = 'records.txt'
self.container = 'myobjects'
self.dep_names = []
self.headers = {}
self.additional_headers = {}
super(TestPartitionsIdentityStorlet, self).setUp()
main_class = 'org.openstack.storlet.PartitionsIdentityStorlet'
super(TestPartitionsIdentityStorlet, self).setUp(
'PartitionsIdentityStorlet',
'partitionsidentitystorlet-1.0.jar',
main_class,
'myobjects',
'records.txt')
def invoke_storlet(self, start, end, first_partition, max_record_line):
headers = {'X-Run-Storlet': self.storlet_name}

View File

@@ -16,7 +16,7 @@ Limitations under the License.
import threading
from swiftclient import client as c
from nose.plugins.attrib import attr
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
class myTestThread (threading.Thread):
@@ -30,18 +30,16 @@ class myTestThread (threading.Thread):
self.test_class.invokeTestStorlet("print", False)
class TestTestStorlet(StorletFunctionalTest):
class TestTestStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'TestStorlet'
self.storlet_name = 'test-10.jar'
self.storlet_main = 'org.openstack.storlet.test.test1'
self.storlet_log = ''
self.headers = None
self.storlet_file = ''
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
super(TestTestStorlet, self).setUp()
main_class = 'org.openstack.storlet.test.test1'
super(TestTestStorlet, self).setUp('TestStorlet',
'test-10.jar',
main_class,
'myobjects',
'')
c.put_object(self.url,
self.token,

View File

@@ -15,23 +15,21 @@ Limitations under the License.
from swiftclient import client as c
from __init__ import StorletFunctionalTest
from tests.functional.java import StorletJavaFunctionalTest
from eventlet.green import urllib2
class TestThumbnailStorlet(StorletFunctionalTest):
class TestThumbnailStorlet(StorletJavaFunctionalTest):
def setUp(self):
self.storlet_dir = 'ThumbnailStorlet'
self.storlet_name = 'thumbnail-1.0.jar'
self.storlet_main = 'org.openstack.storlet.thumbnail.ThumbnailStorlet'
self.storlet_log = None
self.headers = None
self.storlet_file = 'sample.jpg'
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
super(TestThumbnailStorlet, self).setUp()
main_class = 'org.openstack.storlet.thumbnail.ThumbnailStorlet'
super(TestThumbnailStorlet, self).setUp('ThumbnailStorlet',
'thumbnail-1.0.jar',
main_class,
'myobjects',
'sample.jpg')
def invoke_storlet_on_get(self):
headers = {'X-Run-Storlet': self.storlet_name}

View File

@@ -0,0 +1,33 @@
# Copyright (c) 2010-2016 OpenStack Foundation
#
# 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.
import os
from tests.functional import StorletFunctionalTest, PATH_TO_STORLETS
class StorletPythonFunctionalTest(StorletFunctionalTest):
def setUp(self, storlet_dir, storlet_name, storlet_main,
container, storlet_file, dep_names=None, headers=None):
storlet_dir = os.path.join('python', storlet_dir)
path_to_bundle = os.path.join(PATH_TO_STORLETS, storlet_dir)
super(StorletPythonFunctionalTest, self).setUp('Python',
path_to_bundle,
storlet_dir,
storlet_name,
storlet_main,
container,
storlet_file,
dep_names,
headers)

View File

@@ -14,23 +14,17 @@
# limitations under the License.
from swiftclient import client
from tests.functional import StorletFunctionalTest
from tests.functional.python import StorletPythonFunctionalTest
class TestSimpleStorlet(StorletFunctionalTest):
class TestSimpleStorlet(StorletPythonFunctionalTest):
def setUp(self):
self.storlet_dir = 'python/simple'
self.storlet_name = 'simple.py'
self.storlet_main = 'simple.SimpleStorlet'
self.storlet_log = 'simple.log'
self.headers = {}
self.storlet_file = 'source.txt'
self.content = 'abcdefghijklmonp'
self.container = 'myobjects'
self.dep_names = []
self.additional_headers = {}
self.language = 'Python'
super(TestSimpleStorlet, self).setUp(self.language)
super(TestSimpleStorlet, self).setUp('simple', 'simple.py',
'simple.SimpleStorlet',
'myobjects', 'source.txt')
def test_get(self):
resp = dict()

View File

@@ -1,2 +0,0 @@
[deploy]
localhost

View File

@@ -1,25 +0,0 @@
#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# 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.
#---------------------------------------------------------------------------
- name: mkdir srv directory
command: mkdir /srv
ignore_errors: yes
- name: create disk file
command: truncate -s 10GB /srv/swift-disk
- name: losetup
command: losetup /dev/loop0 /srv/swift-disk
ignore_errors: yes

View File

@@ -1,30 +0,0 @@
#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# 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.
#---------------------------------------------------------------------------
- stat: path="{{ installation_dir }}"
register: inst_dir
- command: mkdir -p {{ installation_dir }}
when: not inst_dir.stat.exists
- name: clone repo
stat: path="{{ installation_dir }}/{{swift_install_repo_name}}"
register: repo_dir
- git: repo={{ swift_install_repo_url }}
dest={{ installation_dir }}/{{ swift_install_repo_name }}
version=1.0.0
when: not repo_dir.stat.exists
- command: chmod 1777 "{{ installation_dir }}/{{swift_install_repo_name}}"

View File

@@ -1,21 +0,0 @@
#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# 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.
#---------------------------------------------------------------------------
- git: repo=https://github.com/openstack-ansible/openstack-ansible-modules.git
dest={{ installation_dir }}/{{ swift_install_repo_name }}/openstack-ansible-modules
#- command: ansible-playbook -s -i inventory/vagrant/localhost_dynamic_inventory.py main-install.yml
# args:
# chdir: "{{ installation_dir }}{{ swift_install_repo_name }}"

View File

@@ -1,22 +0,0 @@
#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# 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.
#---------------------------------------------------------------------------
- hosts: deploy
vars_files:
- [vars.yml]
roles:
- role: prepare_loop_device
- role: pull_swift_ansible
- role: swift_install

View File

@@ -1,18 +0,0 @@
#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
# 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.
#---------------------------------------------------------------------------
installation_dir: /tmp/swift_install/
swift_install_repo_url: https://github.com/Open-I-Beam/swift-install.git
swift_install_repo_name: swift-install

View File

@@ -1,28 +0,0 @@
# -*- coding: utf-8 -*-
# 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.
"""
test_storlets
----------------------------------
Tests for `storlets` module.
"""
from tests import base
class TestStorlets(base.TestCase):
def test_something(self):
pass