aboutsummaryrefslogtreecommitdiff
path: root/kokoro
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2023-02-10 07:20:32 -0800
committerCopybara-Service <copybara-worker@google.com>2023-02-10 07:22:06 -0800
commitaea5aaee586efaf137c01d250216853f427805f7 (patch)
tree61fedeb9e934ee97b1284ec8aca6861a8fa745d9 /kokoro
parentedc313d55491ccdbe676b20667007c171d1456a1 (diff)
downloadtink-aea5aaee586efaf137c01d250216853f427805f7.tar.gz
Remove unused scripts
PiperOrigin-RevId: 508653855
Diffstat (limited to 'kokoro')
-rw-r--r--kokoro/testutils/BUILD.bazel27
-rwxr-xr-xkokoro/testutils/github_release_util_test.sh412
2 files changed, 0 insertions, 439 deletions
diff --git a/kokoro/testutils/BUILD.bazel b/kokoro/testutils/BUILD.bazel
deleted file mode 100644
index 082d84571..000000000
--- a/kokoro/testutils/BUILD.bazel
+++ /dev/null
@@ -1,27 +0,0 @@
-package(default_visibility = ["//:__subpackages__"])
-
-licenses(["notice"])
-
-sh_binary(
- name = "test_utils",
- srcs = ["test_utils.sh"],
-)
-
-sh_binary(
- name = "github_release_util",
- srcs = ["github_release_util.sh"],
-)
-
-sh_test(
- name = "github_release_util_test",
- size = "small",
- srcs = ["github_release_util_test.sh"],
- args = [
- "$(rootpath :github_release_util.sh)",
- "$(rootpath :test_utils)",
- ],
- data = [
- ":github_release_util.sh",
- ":test_utils",
- ],
-)
diff --git a/kokoro/testutils/github_release_util_test.sh b/kokoro/testutils/github_release_util_test.sh
deleted file mode 100755
index 96ffc7305..000000000
--- a/kokoro/testutils/github_release_util_test.sh
+++ /dev/null
@@ -1,412 +0,0 @@
-#!/bin/bash
-# Copyright 2022 Google LLC
-#
-# 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.
-################################################################################
-
-DEFAULT_DIR="$(pwd)"
-if [[ -n "${TEST_SRCDIR}" ]]; then
- DEFAULT_DIR="${TEST_SRCDIR}/google3"
-fi
-readonly DEFAULT_DIR
-readonly CLI="${DEFAULT_DIR}/${1:-"github_release_util.sh"}"
-readonly TEST_UTILS="${DEFAULT_DIR}/${2:-test_utils.sh}"
-
-# Load the test library.
-source "${TEST_UTILS}"
-
-test_GitHubReleaseUtil_CreateBranchMinorSucceeds() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-git clone ssh://git@github.com/tink-crypto/some-repo
-git branch 1.6
-git push origin 1.6
-EOF
-
- local -r actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_git_cmds_file.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-EOF
- ;;
- "clone")
- local -r repo_name="${1##*/}"
- mkdir "${repo_name}"
- ;;
- *) ;; # Do nothing
- esac
- }
- # Run this in the caller's environment.
- (
- source "${CLI}" -r create_branch 1.6.0 some-repo &> /dev/null
- )
- ASSERT_CMD_SUCCEEDED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateBranchMinorWithCommitSucceeds() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-git clone ssh://git@github.com/tink-crypto/some-repo
-git branch 1.6 6c68b48c884e0aeb983b8864f35187d9584d0d74
-git push origin 1.6
-EOF
- local -r actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_git_cmds_file.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-EOF
- ;;
- "clone")
- local -r repo_name="${1##*/}"
- mkdir "${repo_name}"
- ;;
- *) ;; # Do nothing
- esac
- }
-
- # Run this in the caller's environment.
- (
- source "${CLI}" -r -c 6c68b48c884e0aeb983b8864f35187d9584d0d74 \
- create_branch 1.6.0 some-repo &> /dev/null
- )
- ASSERT_CMD_SUCCEEDED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateTagPatchSucceeds() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-git clone ssh://git@github.com/tink-crypto/some-repo
-git checkout 1.6
-git tag -a v1.6.2 -m some-repo version 1.6.2
-git push origin v1.6.2
-EOF
- local -r actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_git_cmds_file.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-9940095f3081a116fa7a1337ad5ba27a3ccc59fe refs/heads/1.6
-EOF
- ;;
- "clone")
- local -r repo_name="${1##*/}"
- mkdir "${repo_name}"
- ;;
- *) ;; # Do nothing.
- esac
- }
-
- # Run this in the caller's environment.
- (
- source "${CLI}" -r -c 6c68b48c884e0aeb983b8864f35187d9584d0d74 \
- create_tag 1.6.2 some-repo &> /dev/null
- )
- ASSERT_CMD_SUCCEEDED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateBranchFailsWhenLsRemoteFails() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-EOF
- local actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_cmds.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote") return 1 ;;
- *) ;; # Do nothing.
- esac
- }
-
- # Run this in a subshell to prevent exiting on failure.
- (
- source "${CLI}" -r create_branch 1.6.2 some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
- echo "" > "${actual_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateBranchFailsWhenCloneFails() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-git clone ssh://git@github.com/tink-crypto/some-repo
-EOF
- local actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_cmds.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-EOF
- ;;
- "clone") return 1 ;;
- *) ;; # Do nothing.
- esac
- }
-
- # Run this in a subshell to prevent exiting on failure.
- (
- source "${CLI}" -r create_branch 1.6.2 some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateTagFailsIfBranchDoesNotExist() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-EOF
- local actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_cmds.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-EOF
- ;;
- *) ;; # Do nothing.
- esac
- }
-
- # Run this in a subshell to prevent exiting on failure.
- (
- source "${CLI}" -r create_tag 1.6.2 some-repo &> /dev/null
- )
-
- ASSERT_CMD_FAILED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateTagFailsIfReleaseTagAlreadyExists() {
- cd "${TEST_CASE_TMPDIR}"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ssh://git@github.com/tink-crypto/some-repo
-EOF
- local actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_cmds.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-112a7d3a0453a1d926448519f94fe5a91c69be45 refs/heads/1.6
-8c266441044c4dfaf7560e21663a8037043b750b refs/tags/v1.6.2
-195ec3c1edeee8877ab5dc287f95c4402e3fb510 refs/tags/v1.6.1
-c6f48771296bca0bd22724b208abafeae7d7b764 refs/tags/v1.6.0
-EOF
- ;;
- *) ;; # Do nothing.
- esac
- }
-
- # Run this in a subshell to prevent exiting on failure.
- (
- source "${CLI}" -r create_tag 1.6.2 some-repo &> /dev/null
- )
-
- ASSERT_CMD_FAILED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_FailsWhenInvalidVersion() {
- cd "${TEST_CASE_TMPDIR}"
- for action in create_branch create_tag; do
- (
- source "${CLI}" -r "${action}" 1 some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- (
- source "${CLI}" -r "${action}" 1.2 some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- (
- source "${CLI}" -r "${action}" 1.2.a some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- (
- source "${CLI}" -r "${action}" a.b.c some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- (
- source "${CLI}" -r "${action}" 1.2.3.4 some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- (
- source "${CLI}" -r "${action}" invalid some-repo &> /dev/null
- )
- ASSERT_CMD_FAILED
- done
-}
-
-test_GitHubReleaseUtil_FailsWhenNoRepoNameIsGiven() {
- cd "${TEST_CASE_TMPDIR}"
- for action in create_branch create_tag; do
- # Run this in a subshell to prevent exiting on failure.
- (
- source "${CLI}" -r "${action}" 1.6.0 &> /dev/null
- )
- ASSERT_CMD_FAILED
- done
-}
-
-test_GitHubReleaseUtil_CreateBranchUsesCorrectGithubToken() {
- cd "${TEST_CASE_TMPDIR}"
- local -r access_token="a227da63673c236090a067c3f96b62e74dbd5857"
- local -r expected_url="https://ise-crypto:${access_token}@github.com/tink-crypto/some-repo"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ${expected_url}
-git clone ${expected_url}
-git branch 1.6
-git push origin 1.6
-EOF
- local -r actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_git_cmds_file.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-EOF
- ;;
- "clone")
- local -r repo_name="${1##*/}"
- mkdir "${repo_name}"
- ;;
- *) ;; # Do nothing
- esac
- }
-
- # Run this in the caller's environment.
- (
- source "${CLI}" -r -t "${access_token}" create_branch 1.6.0 some-repo \
- &> /dev/null
- )
- ASSERT_CMD_SUCCEEDED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-test_GitHubReleaseUtil_CreateTagUsesCorrectGithubToken() {
- cd "${TEST_CASE_TMPDIR}"
- local -r access_token="a227da63673c236090a067c3f96b62e74dbd5857"
- local -r expected_url="https://ise-crypto:${access_token}@github.com/tink-crypto/some-repo"
- local -r expected_git_cmds_file="${TEST_CASE_TMPDIR}/expected_cmds.txt"
- cat << EOF > ${expected_git_cmds_file}
-git ls-remote ${expected_url}
-git clone ${expected_url}
-git checkout 1.6
-git tag -a v1.6.2 -m some-repo version 1.6.2
-git push origin v1.6.2
-EOF
- local -r actual_git_cmds_file="${TEST_CASE_TMPDIR}/actual_git_cmds_file.txt"
- # Mock git command.
- git() {
- local -r command="$1"
- shift 1
- cmd_and_args="git ${command} $@"
- echo "${cmd_and_args}" >> "${actual_git_cmds_file}"
- case "${command}" in
- "ls-remote")
- cat << EOF
-6c68b48c884e0aeb983b8864f35187d9584d0d74 HEAD
-6c68b48c884e0aeb983b8864f35187d9584d0d74 refs/heads/main
-112a7d3a0453a1d926448519f94fe5a91c69be45 refs/heads/1.6
-EOF
- ;;
- "clone")
- local -r repo_name="${1##*/}"
- mkdir "${repo_name}"
- ;;
- *) ;; # Do nothing
- esac
- }
-
- # Run this in the caller's environment.
- (
- source "${CLI}" -r -t "${access_token}" create_tag 1.6.2 some-repo \
- &> /dev/null
- )
- ASSERT_CMD_SUCCEEDED
- ASSERT_FILE_EQUALS "${actual_git_cmds_file}" "${expected_git_cmds_file}"
-}
-
-main() {
- run_all_tests "$@"
-}
-
-main "$@"