From 8bb2879b87b9be2d104f6b3e6266d2058e117252 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Mon, 16 Dec 2024 14:26:13 -0500 Subject: [PATCH] Reflect coverage for view and status subcommands --- .../pr-view-respects-branch-pushremote.txtar | 45 ------------------- .../pr-view-respects-push-destination.txtar | 38 ---------------- .../pr-view-respects-remote-pushdefault.txtar | 45 ------------------- .../pr-view-respects-simple-pushdefault.txtar | 35 --------------- 4 files changed, 163 deletions(-) delete mode 100644 acceptance/testdata/pr/pr-view-respects-branch-pushremote.txtar delete mode 100644 acceptance/testdata/pr/pr-view-respects-push-destination.txtar delete mode 100644 acceptance/testdata/pr/pr-view-respects-remote-pushdefault.txtar delete mode 100644 acceptance/testdata/pr/pr-view-respects-simple-pushdefault.txtar diff --git a/acceptance/testdata/pr/pr-view-respects-branch-pushremote.txtar b/acceptance/testdata/pr/pr-view-respects-branch-pushremote.txtar deleted file mode 100644 index ef80cd8ba..000000000 --- a/acceptance/testdata/pr/pr-view-respects-branch-pushremote.txtar +++ /dev/null @@ -1,45 +0,0 @@ -# Setup environment variables used for testscript -env REPO=${SCRIPT_NAME}-${RANDOM_STRING} -env FORK=${REPO}-fork - -# Use gh as a credential helper -exec gh auth setup-git - -# Create a repository to act as upstream with a file so it has a default branch -exec gh repo create ${ORG}/${REPO} --add-readme --private - -# Defer repo cleanup of upstream -defer gh repo delete --yes ${ORG}/${REPO} -exec gh repo view ${ORG}/${REPO} --json id --jq '.id' -stdout2env REPO_ID - -# Create a user fork of repository as opposed to private organization fork -exec gh repo fork ${ORG}/${REPO} --org ${ORG} --fork-name ${FORK} - -# Defer repo cleanup of fork -defer gh repo delete --yes ${ORG}/${FORK} -sleep 5 -exec gh repo view ${ORG}/${FORK} --json id --jq '.id' -stdout2env FORK_ID - -# Clone the repo -exec gh repo clone ${ORG}/${FORK} -cd ${FORK} - -# Prepare a branch where changes are pulled from the upstream default branch but pushed to fork -exec git checkout -b feature-branch upstream/main -exec git config branch.feature-branch.pushRemote origin -exec git commit --allow-empty -m 'Empty Commit' -exec git push - -# Create the PR spanning upstream and fork repositories, gh pr create does not support headRepositoryId needed for private forks -exec gh api graphql -F repositoryId="${REPO_ID}" -F headRepositoryId="${FORK_ID}" -F query='mutation CreatePullRequest($headRepositoryId: ID!, $repositoryId: ID!) { createPullRequest(input:{ baseRefName: "main", body: "Feature Body", draft: false, headRefName: "feature-branch", headRepositoryId: $headRepositoryId, repositoryId: $repositoryId, title:"Feature Title" }){ pullRequest{ id url } } }' - -# View the PR -exec gh pr view -stdout 'Feature Title' - -# Check the PR status -env PR_STATUS_BRANCH=#1 Feature Title [${ORG}:feature-branch] -exec gh pr status -stdout $PR_STATUS_BRANCH diff --git a/acceptance/testdata/pr/pr-view-respects-push-destination.txtar b/acceptance/testdata/pr/pr-view-respects-push-destination.txtar deleted file mode 100644 index ff9db4037..000000000 --- a/acceptance/testdata/pr/pr-view-respects-push-destination.txtar +++ /dev/null @@ -1,38 +0,0 @@ -# Setup environment variables used for testscript -env REPO=${SCRIPT_NAME}-${RANDOM_STRING} - -# Use gh as a credential helper -exec gh auth setup-git - -# Create a repository with a file so it has a default branch -exec gh repo create ${ORG}/${REPO} --add-readme --private - -# Defer repo cleanup -defer gh repo delete --yes ${ORG}/${REPO} - -# Clone the repo -exec gh repo clone ${ORG}/${REPO} -cd ${REPO} - -# Configure default push behavior so local and remote branches will be the same -exec git config push.default current - -# Prepare a branch where changes are pulled from the default branch instead of remote branch of same name -exec git checkout -b feature-branch -exec git branch --set-upstream-to origin/main -exec git rev-parse --abbrev-ref feature-branch@{upstream} -stdout origin/main - -# Create the PR -exec git commit --allow-empty -m 'Empty Commit' -exec git push -exec gh pr create -B main -H feature-branch --title 'Feature Title' --body 'Feature Body' - -# View the PR -exec gh pr view -stdout 'Feature Title' - -# Check the PR status -env PR_STATUS_BRANCH=#1 Feature Title [feature-branch] -exec gh pr status -stdout $PR_STATUS_BRANCH diff --git a/acceptance/testdata/pr/pr-view-respects-remote-pushdefault.txtar b/acceptance/testdata/pr/pr-view-respects-remote-pushdefault.txtar deleted file mode 100644 index 8bfac2837..000000000 --- a/acceptance/testdata/pr/pr-view-respects-remote-pushdefault.txtar +++ /dev/null @@ -1,45 +0,0 @@ -# Setup environment variables used for testscript -env REPO=${SCRIPT_NAME}-${RANDOM_STRING} -env FORK=${REPO}-fork - -# Use gh as a credential helper -exec gh auth setup-git - -# Create a repository to act as upstream with a file so it has a default branch -exec gh repo create ${ORG}/${REPO} --add-readme --private - -# Defer repo cleanup of upstream -defer gh repo delete --yes ${ORG}/${REPO} -exec gh repo view ${ORG}/${REPO} --json id --jq '.id' -stdout2env REPO_ID - -# Create a user fork of repository as opposed to private organization fork -exec gh repo fork ${ORG}/${REPO} --org ${ORG} --fork-name ${FORK} - -# Defer repo cleanup of fork -defer gh repo delete --yes ${ORG}/${FORK} -sleep 5 -exec gh repo view ${ORG}/${FORK} --json id --jq '.id' -stdout2env FORK_ID - -# Clone the repo -exec gh repo clone ${ORG}/${FORK} -cd ${FORK} - -# Prepare a branch where changes are pulled from the upstream default branch but pushed to fork -exec git checkout -b feature-branch upstream/main -exec git config remote.pushDefault origin -exec git commit --allow-empty -m 'Empty Commit' -exec git push - -# Create the PR spanning upstream and fork repositories, gh pr create does not support headRepositoryId needed for private forks -exec gh api graphql -F repositoryId="${REPO_ID}" -F headRepositoryId="${FORK_ID}" -F query='mutation CreatePullRequest($headRepositoryId: ID!, $repositoryId: ID!) { createPullRequest(input:{ baseRefName: "main", body: "Feature Body", draft: false, headRefName: "feature-branch", headRepositoryId: $headRepositoryId, repositoryId: $repositoryId, title:"Feature Title" }){ pullRequest{ id url } } }' - -# View the PR -exec gh pr view -stdout 'Feature Title' - -# Check the PR status -env PR_STATUS_BRANCH=#1 Feature Title [${ORG}:feature-branch] -exec gh pr status -stdout $PR_STATUS_BRANCH diff --git a/acceptance/testdata/pr/pr-view-respects-simple-pushdefault.txtar b/acceptance/testdata/pr/pr-view-respects-simple-pushdefault.txtar deleted file mode 100644 index 114f401ec..000000000 --- a/acceptance/testdata/pr/pr-view-respects-simple-pushdefault.txtar +++ /dev/null @@ -1,35 +0,0 @@ -# Setup environment variables used for testscript -env REPO=${SCRIPT_NAME}-${RANDOM_STRING} - -# Use gh as a credential helper -exec gh auth setup-git - -# Create a repository with a file so it has a default branch -exec gh repo create ${ORG}/${REPO} --add-readme --private - -# Defer repo cleanup -defer gh repo delete --yes ${ORG}/${REPO} - -# Clone the repo -exec gh repo clone ${ORG}/${REPO} -cd ${REPO} - -# Configure default push behavior so local and remote branches have to be the same -exec git config push.default simple - -# Prepare a branch where changes are pulled from the default branch instead of remote branch of same name -exec git checkout -b feature-branch origin/main - -# Create the PR -exec git commit --allow-empty -m 'Empty Commit' -exec git push origin feature-branch -exec gh pr create -H feature-branch --title 'Feature Title' --body 'Feature Body' - -# View the PR -exec gh pr view -stdout 'Feature Title' - -# Check the PR status -env PR_STATUS_BRANCH=#1 Feature Title [feature-branch] -exec gh pr status -stdout $PR_STATUS_BRANCH