~ubuntu-branches/ubuntu/vivid/neutron/vivid-updates

« back to all changes in this revision

Viewing changes to tools/copy_api_tests_from_tempest.sh

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-03-30 11:17:19 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150330111719-h0gx7233p4jkkgfh
Tags: 1:2015.1~b3-0ubuntu1
* New upstream milestone release:
  - d/control: Align version requirements with upstream.
  - d/control: Add new dependency on oslo-log.
  - d/p/*: Rebase.
  - d/control,d/neutron-plugin-hyperv*: Dropped, decomposed into
    separate project upstream.
  - d/control,d/neutron-plugin-openflow*: Dropped, decomposed into
    separate project upstream.
  - d/neutron-common.install: Add neutron-rootwrap-daemon and 
    neutron-keepalived-state-change binaries.
  - d/rules: Ignore neutron-hyperv-agent when installing; only for Windows.
  - d/neutron-plugin-cisco.install: Drop neutron-cisco-cfg-agent as
    decomposed into separate project upstream.
  - d/neutron-plugin-vmware.install: Drop neutron-check-nsx-config and
    neutron-nsx-manage as decomposed into separate project upstream.
  - d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent.
* d/pydist-overrides: Add overrides for oslo packages.
* d/control: Fixup type in package description (LP: #1263539).
* d/p/fixup-driver-test-execution.patch: Cherry pick fix from upstream VCS
  to support unit test exection in out-of-tree vendor drivers.
* d/neutron-common.postinst: Allow general access to /etc/neutron but limit
  access to root/neutron to /etc/neutron/neutron.conf to support execution
  of unit tests in decomposed vendor drivers.
* d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# This script is intended to allow repeatable migration of the neutron
 
4
# api tests from tempest.  The intention is to allow development to
 
5
# continue in Tempest while the migration strategy evolves.
 
6
 
 
7
set -e
 
8
 
 
9
if [[ "$#" -ne 1 ]]; then
 
10
    >&2 echo "Usage: $0 /path/to/tempest
 
11
Migrate neutron's api tests from a tempest repo."
 
12
    exit 1
 
13
fi
 
14
 
 
15
TEMPEST_PATH=${TEMPEST_PATH:-$1}
 
16
 
 
17
if [ ! -f "$TEMPEST_PATH/run_tempest.sh" ]; then
 
18
  >&2 echo "Unable to find tempest at '$TEMPEST_PATH'.  Please verify that the specified path points to a valid tempest repo."
 
19
  exit 1
 
20
fi
 
21
 
 
22
NEUTRON_PATH=${NEUTRON_PATH:-$(cd $(dirname "$0")/.. && pwd)}
 
23
NEUTRON_TEST_PATH=$NEUTRON_PATH/neutron/tests
 
24
 
 
25
function copy_files {
 
26
    local tempest_dep_paths=(
 
27
        'tempest'
 
28
        'tempest/api/network'
 
29
        'tempest/api/network/admin'
 
30
        'tempest/common'
 
31
        'tempest/common/generator'
 
32
        'tempest/common/utils'
 
33
        'tempest/services'
 
34
        'tempest/services/identity'
 
35
        'tempest/services/identity/v2'
 
36
        'tempest/services/identity/v2/json'
 
37
        'tempest/services/identity/v3'
 
38
        'tempest/services/identity/v3/json'
 
39
        'tempest/services/network'
 
40
        'tempest/services/network/json'
 
41
    )
 
42
    for tempest_dep_path in ${tempest_dep_paths[@]}; do
 
43
        local target_path=$NEUTRON_TEST_PATH/$tempest_dep_path
 
44
        if [[ ! -d "$target_path" ]]; then
 
45
            mkdir -p $target_path
 
46
        fi
 
47
        cp $TEMPEST_PATH/$tempest_dep_path/*.py $target_path
 
48
    done
 
49
    touch $NEUTRON_TEST_PATH/tempest/api/__init__.py
 
50
 
 
51
    local paths_to_remove=(
 
52
        "$NEUTRON_TEST_PATH/tempest/clients.py"
 
53
    )
 
54
    for path_to_remove in ${paths_to_remove[@]}; do
 
55
        if [ -f "$path_to_remove" ]; then
 
56
            rm ${path_to_remove}
 
57
        fi
 
58
    done
 
59
}
 
60
 
 
61
function rewrite_imports {
 
62
    regexes=(
 
63
        's/tempest.common.generator/neutron.tests.tempest.common.generator/'
 
64
        's/tempest.test/neutron.tests.tempest.test/'
 
65
        's/from tempest.openstack.common import lockutils/from oslo_concurrency import lockutils/'
 
66
        's/from tempest.openstack.common import importutils/from oslo_utils import importutils/'
 
67
        's/tempest.openstack.common/neutron.openstack.common/'
 
68
        's/from tempest(?!_lib) import clients/from neutron.tests.api.contrib import clients/'
 
69
        's/from tempest(?!_lib)/from neutron.tests.tempest/'
 
70
        's/CONF.lock_path/CONF.oslo_concurrency.lock_path/'
 
71
    )
 
72
    files=$(find $NEUTRON_TEST_PATH/tempest -name '*.py')
 
73
    for ((i = 0; i < ${#regexes[@]}; i++)); do
 
74
        perl -p -i -e "${regexes[$i]}" $files
 
75
    done
 
76
}
 
77
 
 
78
copy_files
 
79
rewrite_imports