Skip to content

Commit

Permalink
Fix //script/release:release_test
Browse files Browse the repository at this point in the history
Fixes #2003.

--
MOS_MIGRATED_REVID=137545010
  • Loading branch information
kchodorow authored and katre committed Oct 28, 2016
1 parent 3834019 commit 5abb90d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions scripts/release/release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ EOF
}

function create() {
${RELEASE_SCRIPT} create $@ \
|| fail "Failed to cut release $1 at commit $2"
local branch=$(git_get_branch)
assert_equals "release-$1" "$branch"
git show -s --pretty=format:%B >$TEST_log
local old_branch=$(git_get_branch)
${RELEASE_SCRIPT} create $@ &> $TEST_log \
|| fail "Failed to cut release $1 at commit $2"
local new_branch=$(git_get_branch)
assert_equals "$old_branch" "$new_branch"
assert_contains "Created $1.* on branch release-$1." $TEST_log
git show -s --pretty=format:%B "release-$1" >$TEST_log
}

function push() {
local branch=$(git_get_branch)
local branch="release-$1"
git checkout "$branch"
${RELEASE_SCRIPT} push || fail "Failed to push release branch $branch"
git --git-dir=${GITHUB_ROOT} branch >$TEST_log
expect_log "$branch"
Expand Down Expand Up @@ -105,7 +108,8 @@ function release() {

function abandon() {
local tag="$1"
local branch=$(git_get_branch)
local branch="release-$tag"
git checkout "$branch"
local changelog="$(git show master:CHANGELOG.md)"
local master_sha1=$(git rev-parse master)
echo y | ${RELEASE_SCRIPT} abandon || fail "Failed to abandon release ${branch}"
Expand Down Expand Up @@ -144,7 +148,7 @@ function test_release_workflow() {
expect_log "Release v0"
expect_log "Initial release"
# Push the release branch
push
push v0
# Do the initial release
release v0

Expand Down Expand Up @@ -202,7 +206,7 @@ Cherry picks:
'
assert_equals "${header}Test replacement" "$(cat ${TEST_log})"
push
push v1

# Test creating a second candidate
echo "#!$(which true)" >${EDITOR}
Expand All @@ -225,7 +229,7 @@ Cherry picks:
assert_equals 2 "$(get_release_candidate)"

# Push the release
push
push v1
release v1

# Third release to test abandon
Expand All @@ -251,7 +255,7 @@ EOF
expect_log "Baseline: 2464526"
expect_not_log "HOOK-SHOULD-BE-IGNORED"
# Push
push
push v2
# Abandon it
abandon v2
}
Expand Down

0 comments on commit 5abb90d

Please sign in to comment.