summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitreview5
-rw-r--r--imagescanner/imagescanner/tests/test_config.py46
-rw-r--r--imagescanner/imagescanner/tests/test_frontend.py45
-rwxr-xr-xmvn-phase-script.sh58
-rw-r--r--pom.xml47
-rw-r--r--requirements.txt4
-rw-r--r--tox.ini5
7 files changed, 203 insertions, 7 deletions
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..6b2b193
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.onap.org
+port=29418
+project=vvp/image-scanner.git
+
diff --git a/imagescanner/imagescanner/tests/test_config.py b/imagescanner/imagescanner/tests/test_config.py
new file mode 100644
index 0000000..41dd446
--- /dev/null
+++ b/imagescanner/imagescanner/tests/test_config.py
@@ -0,0 +1,46 @@
+# ============LICENSE_START=======================================================
+# org.onap.vvp/image-scanner
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+import os
+from .. import config
+from pathlib import Path
+
+
+def test_configuration():
+ os.environ['IMAGESCANNER_LOGS_PATH'] = '.'
+ assert config.LOGS_PATH == Path('.')
diff --git a/imagescanner/imagescanner/tests/test_frontend.py b/imagescanner/imagescanner/tests/test_frontend.py
new file mode 100644
index 0000000..695961e
--- /dev/null
+++ b/imagescanner/imagescanner/tests/test_frontend.py
@@ -0,0 +1,45 @@
+# ============LICENSE_START=======================================================
+# org.onap.vvp/image-scanner
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+from .. import frontend
+
+
+def test_frontend_invalid():
+ app = frontend.app
+ resp = app.test_client().get('/imagescanner/result/invalidlocation')
+ assert resp.status_code == 404
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
new file mode 100755
index 0000000..0857b19
--- /dev/null
+++ b/mvn-phase-script.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# ================================================================================
+# Copyright (c) 2017 AT&T Intellectual Property. 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.
+# ============LICENSE_END=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+set -ex
+
+
+echo "running script: [$0] for module [$1] at stage [$2]"
+
+MVN_PROJECT_MODULEID="$1"
+MVN_PHASE="$2"
+PROJECT_ROOT=$(dirname $0)
+
+run_tox_test () {
+ CURDIR=$(pwd)
+ TOXINIS=$(find . -name "tox.ini")
+ for TOXINI in "${TOXINIS[@]}"; do
+ DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
+ cd "${CURDIR}/${DIR}"
+ rm -rf ./venv-tox ./.tox
+ virtualenv ./venv-tox
+ source ./venv-tox/bin/activate
+ pip install --upgrade pip
+ pip install --upgrade tox argparse
+ pip freeze
+ tox
+ deactivate
+ rm -rf ./venv-tox ./.tox
+ done
+}
+
+# Customize the section below for each project
+case $MVN_PHASE in
+test)
+ echo "==> test phase script"
+ run_tox_test
+ ;;
+*)
+ echo "==> unprocessed phase"
+ ;;
+esac
+
diff --git a/pom.xml b/pom.xml
index 798a068..9f45b44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
<version>1.1.0</version>
</parent>
- <groupId>org.openecomp.vvp.image-scanner</groupId>
+ <groupId>org.onap.vvp.image-scanner</groupId>
<artifactId>image-scanner</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
@@ -16,7 +16,7 @@
<properties>
<!--nexus-->
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
- <sitePath>/content/sites/site/org/openecomp/vvp/${project.artifactId}/${project.version}</sitePath>
+ <sitePath>/content/sites/site/org/onap/vvp/${project.artifactId}/${project.version}</sitePath>
<!--maven-->
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
@@ -25,9 +25,28 @@
<docker.latest.tag>${project.version}-latest</docker.latest.tag>
<docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
<docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
+ <!--sonar-->
+ <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
+ <sonar.sources>.</sonar.sources>
+ <sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
+ <sonar.language>py</sonar.language>
+ <sonar.pluginName>python</sonar.pluginName>
+ <sonar.inclusions>imagescanner/imagescanner/**.py</sonar.inclusions>
</properties>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <configuration>
+ <executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
@@ -49,7 +68,7 @@
<pushRegistry>${docker.push.registry}</pushRegistry>
<images>
<image>
- <name>openecomp/vvp/image-scanner</name>
+ <name>onap/vvp/image-scanner</name>
<alias>image-scanner</alias>
<build>
<cleanup>true</cleanup>
@@ -90,11 +109,31 @@
<goal>push</goal>
</goals>
<configuration>
- <image>openecomp/vvp/image-scanner</image>
+ <image>onap/vvp/image-scanner</image>
</configuration>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <executions>
+ <execution>
+ <id>test script</id>
+ <phase>test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <arguments>
+ <argument>__</argument>
+ <argument>test</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<distributionManagement>
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..62f85d5
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+celery[redis]
+flask
+requests
+requests-aws
diff --git a/tox.ini b/tox.ini
index b976be2..fa9b95b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -9,13 +9,12 @@ distribute = False
commands =
{envpython} --version
pytest --version
- pytest --cov=imagescanner
-deps =
+ pytest --cov imagescanner --cov-report=xml --cov-report=term --verbose
+deps = -rrequirements.txt
flake8
pytest-cov
pytest
-
[testenv:style]
basepython=python3.6
commands = python --version