From 9ce4af1dd730afd1c875ab9763d56bfa14728296 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Sat, 13 Apr 2013 20:09:22 +0000 Subject: rename trove-prefix and trove_prefix to trove_id --- tests/trove-id.script | 100 ++++++++++++++++++++++++++++++++++++++++++++++ tests/trove-prefix.script | 100 ---------------------------------------------- 2 files changed, 100 insertions(+), 100 deletions(-) create mode 100755 tests/trove-id.script delete mode 100755 tests/trove-prefix.script (limited to 'tests') diff --git a/tests/trove-id.script b/tests/trove-id.script new file mode 100755 index 00000000..7157559b --- /dev/null +++ b/tests/trove-id.script @@ -0,0 +1,100 @@ +#!/bin/sh +# +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Verify that trove-id (and by corollary trove-host) work properly. + +set -eu + +RAWDUMP="$DATADIR/raw-configdump" +PROCESSEDDUMP="$DATADIR/processed-configdump" + +# Step 1, gather all the raw and processed repo-alias entries + +"$SRCDIR/scripts/test-morph" \ + --trove-host="TROVEHOST" \ + --trove-id="fudge" \ + --trove-id="github" \ + --dump-config > "$RAWDUMP" +env MORPH_DUMP_PROCESSED_CONFIG=1 "$SRCDIR/scripts/test-morph" \ + --trove-host="TROVEHOST" \ + --trove-id="fudge" \ + --trove-id="github" \ + > "$PROCESSEDDUMP" + +RAW_ALIAS=$(grep repo-alias "$RAWDUMP" | cut -d\ -f3-) +PROCESSED_ALIAS=$(grep repo-alias "$PROCESSEDDUMP" | cut -d\ -f3-) + +find_alias () { + ALIASES="$1" + WHICH="$2" + for alias in $ALIASES; do + alias=$(echo $alias | sed -e's/,$//') + prefix=$(echo $alias | cut -d= -f1) + if test "x$WHICH" = "x$prefix"; then + echo $alias + exit 0 + fi + done +} + +# Step 2, all raw aliases should be in processed aliases unchanged. As part of +# this, we're also validating that the 'github' prefix we pass in does not +# affect the alias output since it is overridden by repo-alias. + +for raw_alias in $RAW_ALIAS; do + raw_alias=$(echo $raw_alias | sed -e's/,$//') + raw_prefix=$(echo $raw_alias | cut -d= -f1) + processed_alias=$(find_alias "$PROCESSED_ALIAS" "$raw_prefix") + if test "x$raw_alias" != "x$processed_alias"; then + echo >&2 "Raw $raw_alias not in processed aliases" + fi +done + +# Step 3, all aliases in the processed aliases which do not come from the raw +# aliases should contain the trove host. + +for processed_alias in $PROCESSED_ALIAS; do + processed_alias=$(echo $processed_alias | sed -e's/,$//') + processed_prefix=$(echo $processed_alias | cut -d= -f1) + raw_alias=$(find_alias "$RAW_ALIAS" "$processed_prefix") + if test "x$raw_alias" = "x"; then + grep_out=$(echo "$processed_alias" | grep TROVEHOST) + if test "x$grep_out" = "x"; then + echo >&2 "Processed $processed_alias does not mention TROVEHOST" + fi + fi +done + +# Step 4, validate that the processed aliases do contain a baserock and an +# upstream alias since those are implicit in morph's behaviour. + +for prefix in baserock upstream; do + processed_alias=$(find_alias "$PROCESSED_ALIAS" "$prefix") + if test "x$processed_alias" = "x"; then + echo >&2 "Processed aliases lack $prefix prefix" + fi +done + +# Step 5, validate that the fudge prefix has been correctly expanded as though +# it were fudge=fudge#ssh#ssh + +fudge_alias=$(find_alias "$PROCESSED_ALIAS" "fudge") +desired_fudge="fudge=ssh://git@TROVEHOST/fudge/%s#ssh://git@TROVEHOST/fudge/%s" +if test "x$fudge_alias" != "x$desired_fudge"; then + echo >&2 "Fudge alias was '$fudge_alias' where we wanted '$desired_fudge'" +fi diff --git a/tests/trove-prefix.script b/tests/trove-prefix.script deleted file mode 100755 index 0f8cee3f..00000000 --- a/tests/trove-prefix.script +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 Codethink Limited -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Verify that trove-prefix (and by corollary trove-host) work properly. - -set -eu - -RAWDUMP="$DATADIR/raw-configdump" -PROCESSEDDUMP="$DATADIR/processed-configdump" - -# Step 1, gather all the raw and processed repo-alias entries - -"$SRCDIR/scripts/test-morph" \ - --trove-host="TROVEHOST" \ - --trove-prefix="fudge" \ - --trove-prefix="github" \ - --dump-config > "$RAWDUMP" -env MORPH_DUMP_PROCESSED_CONFIG=1 "$SRCDIR/scripts/test-morph" \ - --trove-host="TROVEHOST" \ - --trove-prefix="fudge" \ - --trove-prefix="github" \ - > "$PROCESSEDDUMP" - -RAW_ALIAS=$(grep repo-alias "$RAWDUMP" | cut -d\ -f3-) -PROCESSED_ALIAS=$(grep repo-alias "$PROCESSEDDUMP" | cut -d\ -f3-) - -find_alias () { - ALIASES="$1" - WHICH="$2" - for alias in $ALIASES; do - alias=$(echo $alias | sed -e's/,$//') - prefix=$(echo $alias | cut -d= -f1) - if test "x$WHICH" = "x$prefix"; then - echo $alias - exit 0 - fi - done -} - -# Step 2, all raw aliases should be in processed aliases unchanged. As part of -# this, we're also validating that the 'github' prefix we pass in does not -# affect the alias output since it is overridden by repo-alias. - -for raw_alias in $RAW_ALIAS; do - raw_alias=$(echo $raw_alias | sed -e's/,$//') - raw_prefix=$(echo $raw_alias | cut -d= -f1) - processed_alias=$(find_alias "$PROCESSED_ALIAS" "$raw_prefix") - if test "x$raw_alias" != "x$processed_alias"; then - echo >&2 "Raw $raw_alias not in processed aliases" - fi -done - -# Step 3, all aliases in the processed aliases which do not come from the raw -# aliases should contain the trove host. - -for processed_alias in $PROCESSED_ALIAS; do - processed_alias=$(echo $processed_alias | sed -e's/,$//') - processed_prefix=$(echo $processed_alias | cut -d= -f1) - raw_alias=$(find_alias "$RAW_ALIAS" "$processed_prefix") - if test "x$raw_alias" = "x"; then - grep_out=$(echo "$processed_alias" | grep TROVEHOST) - if test "x$grep_out" = "x"; then - echo >&2 "Processed $processed_alias does not mention TROVEHOST" - fi - fi -done - -# Step 4, validate that the processed aliases do contain a baserock and an -# upstream alias since those are implicit in morph's behaviour. - -for prefix in baserock upstream; do - processed_alias=$(find_alias "$PROCESSED_ALIAS" "$prefix") - if test "x$processed_alias" = "x"; then - echo >&2 "Processed aliases lack $prefix prefix" - fi -done - -# Step 5, validate that the fudge prefix has been correctly expanded as though -# it were fudge=fudge#ssh#ssh - -fudge_alias=$(find_alias "$PROCESSED_ALIAS" "fudge") -desired_fudge="fudge=ssh://git@TROVEHOST/fudge/%s#ssh://git@TROVEHOST/fudge/%s" -if test "x$fudge_alias" != "x$desired_fudge"; then - echo >&2 "Fudge alias was '$fudge_alias' where we wanted '$desired_fudge'" -fi -- cgit v1.2.1