Commit graph

49 commits

Author SHA1 Message Date
William Martin
18dc5e77f0 Add sampled command telemetry 2026-04-16 21:42:46 +02:00
tommaso-moro
758785b8f4
improve test coverage/cleanup 2026-04-15 15:45:29 +02:00
Kynan Ware
6666850871 fix(acceptance): set git identity in testscript sandbox
The sandbox overrides HOME so git cannot find the user's global config,
causing 'Author identity unknown' errors when acceptance test scripts
make commits. Write a minimal .gitconfig with user.name and user.email
into the sandbox working directory during sharedSetup.

Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-25 12:47:44 -06:00
Andy Feller
018b6d6d07 Initial pass fixing gh issue and gh pr comment
There is still a bit of work to get the gh pr comment tests in order, however this goes a way towards fixing the issue along with acceptance tests.

Also, it turns out some of the issue acceptance tests were really running `pr` tests.
2025-03-17 23:18:36 -04:00
Andy Feller
ed24477fd3 Add comprehensive testscript for gh ext commandset
Rather than multiple separate testscripts per `gh ext` subcommand, this commit adds a comprehensive test around `gh extension` commandset.
2024-10-28 12:54:47 +01:00
Andy Feller
c27677bda6 Add comprehensive testscript for gh ruleset 2024-10-28 12:40:12 +01:00
William Martin
f35c123b71
Merge pull request #9816 from cli/jtmcg/testscripts-project
Add acceptance test for `project` command
2024-10-28 12:24:53 +01:00
William Martin
30d9fc53d1 Update testscript to use hard fork 2024-10-25 16:29:23 +02:00
Tyler McGoffin
8b5c5385c7 Add TestProject to acceptance_test.go 2024-10-24 12:18:56 -07:00
Tyler McGoffin
31e8a87598 Alphabetize test functions
While swarming on this, I've encountered many merge conflicts based on
where folks have introduced new test functions. Alphabetizing them should
reduce the number of merge conflicts we encounter while introducing more
of these tests moving forward
2024-10-24 10:01:39 -07:00
William Martin
2a2adfed0f
Merge pull request #9787 from cli/jtmcg/testscripts-auth
Add acceptance tests for `gh auth` commands
2024-10-24 18:42:31 +02:00
bagtoad
2f849f03ff Add acceptance tests for org command 2024-10-24 09:58:06 -06:00
William Martin
76e6fbba36 Add SSH Key Acceptance test 2024-10-24 17:46:17 +02:00
William Martin
4100992d40 Add Acceptance test for label command 2024-10-24 17:00:54 +02:00
bagtoad
f27cddcb92 Add acceptance test for gpg-key 2024-10-24 08:43:40 -06:00
Tyler McGoffin
2b480daf7a Address PR feedback 2024-10-23 13:57:57 -07:00
Tyler McGoffin
0614d85027 Add acceptance tests for auth-setup-git and formattedStringToEnv helper func
To test this, I decided to look into the .gitconfig used for the test and
examine the credential helpers. However, the format of the git command is

`git config --get credential.<URL>.helper`

What's awkward about this is that the <URL> depends on the host the user
specified when running the tests, meaning I'd need to create a key like
credential.https://github.com.helper to access what I need while setting
this up.

There was no functionality for string formatting before, so I added the
command formattedStringToEnv which essentially wraps fmt.Sprintf() and
saves the string to an environment variable.

This allowed me to dynamically create the config key in the test.
2024-10-23 13:33:17 -07:00
Tyler McGoffin
aaf4c4e4e3 Clean up auth-login-logout acceptance test with native functionality
The previous commit introduced two new functions, setEnvVar and
deleteEnvVar that are duplicative of functionality native to testscripts.
This commit switches to the native functionality and removes the
duplicative functions introduced in the previous commit.

Additionally, it removes the `--token` flag that was added to
`gh auth login`
2024-10-21 16:42:48 -07:00
Tyler McGoffin
52daa9cf7d Add --token flag to gh auth login to accept a PAT as a flag
Additionally, this commit adds acceptance testing for `gh auth login` and
`gh auth logout`.

The --token flag was necessary for adding testing for `gh auth login`
because the current implementation with `--with-token` appears to be
broken. It hangs, waiting for user input, but user input doesn't exit it.

Additionally, it appears that `--with-token` is intended to allow for TTY
input of an auth token, but it isn't implemented.

`--with-token` does work when used with the redirect operator `<` when the
token is saved in a file. However, due to limitations of testscripts, I
could not use a file for saving the token in a repeatable manner. Thus,
implementing the `--token` flag seemed like a quick solution to validate
that the direction I was going during testing was valid.

Whether the flag stays or not is up for discussion, and I'd love to get
input on that from the team.
2024-10-21 16:38:10 -07:00
Tyler McGoffin
665e814c5d Setup acceptance testing for auth and tests for auth-token and auth-status 2024-10-21 16:36:05 -07:00
Andy Feller
fa03013a23 Merge branch 'trunk' into andyfeller/testscripts-variable 2024-10-21 15:38:56 -04:00
Andy Feller
b3c0c39f47 Merge branch 'trunk' into andyfeller/testscripts-secret 2024-10-21 12:49:09 -04:00
Kynan Ware
e39a78ea29
Merge branch 'trunk' into kw/github-cli-590-add-search-acceptance-tests 2024-10-21 10:23:00 -06:00
Andy Feller
acf62dacf2 Address @williammartin PR feedback 2024-10-21 11:53:05 -04:00
Andy Feller
f4f161c096 Refactor gh secret testscript
This is a bit of a refactor based on the work done in `gh workflow` as a better approach to verify secrets created are what we expect.

Changes made:

1. Removed `env2lower` as it wasn't being used in testscripts
2. Added `replace` custom command to deal with testing organization workflow secrets
3. Refactored secret testscripts to create and run workflow that tests the value of the secret provided
4. Minor reordering of test `acceptance` test functions as appending to the end is confusing and adds conflicts
5. Removed stdout TTY assertions
2024-10-18 15:56:03 -04:00
Tyler McGoffin
3f4a2aea2f Rename acceptance test directory from repos to repo 2024-10-18 09:37:30 -07:00
Tyler McGoffin
18428671c3 Added test function for repos and repo-create test 2024-10-18 09:31:02 -07:00
bagtoad
b361cf4495 Implement acceptance tests for search commands 2024-10-18 10:17:34 -06:00
Andy Feller
1571a113c2 Merge branch 'trunk' into andyfeller/testscripts-secret 2024-10-18 09:46:25 -04:00
Andy Feller
e8842f861f Add missing test to trigger acceptance tests 2024-10-17 16:03:37 -04:00
Andy Feller
7c534e6010 Refactor env2upper, env2lower; add docs
This commit refactors 2 new custom commands to work more like the native env command, allowing for multiple environment variables to be set.

Additionally, the documentation on acceptance tests have been expanded to list out custom commands.
2024-10-17 10:49:17 -04:00
Andy Feller
b1792403be Add testscripts for gh secret, helper cmds
These are initial testscripts for confidence around core `gh secret` subcommands around 1) repository, 2) repository environment, 3) organization secrets.

Each testscript exercises the 3 core subcommands of `gh secret`: 1) setting, 2) listing, and 3) deleting each type of secret.

Note should be made that repository environments do not exist for free accounts such as `gh-acceptance-testing`.
2024-10-17 10:09:08 -04:00
bagtoad
a009933a16 Add acceptance tests for release commands 2024-10-17 16:06:10 +02:00
bagtoad
06c20f3a8b Implement basic API acceptance test 2024-10-17 15:39:29 +02:00
William Martin
f21ac8f68e
Merge pull request #9766 from cli/kw/github-cli-585-add-acceptance-tests-for-actions-commands
Add acceptance tests for `workflow`, `run`, and `cache` commands
2024-10-17 15:36:54 +02:00
Andy Feller
a6974cc8d6
Merge pull request #9757 from cli/wm/testscript-issues
Add Acceptance tests for `issue` command
2024-10-15 14:47:33 -04:00
bagtoad
c3ffdc90c8 implement base workflow list acceptance test 2024-10-15 11:01:09 -06:00
Tyler McGoffin
c1939e9c15
Merge pull request #9754 from cli/wm/acceptance-test-defer-fails
Ensure Acceptance defer failures are debuggable
2024-10-14 14:58:26 -07:00
William Martin
6970eb36f1 Acceptance test issue command 2024-10-14 20:53:43 +02:00
William Martin
5ad4a385bb Support GH_ACCEPTANCE_SCRIPT 2024-10-14 20:44:07 +02:00
William Martin
3b1f06a88f Ensure Acceptance defer failures are debuggable 2024-10-14 20:27:34 +02:00
William Martin
5e02326792
Document sharedCmds func in acceptance tests
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-10-14 14:36:34 +02:00
William Martin
bfa5b6afa5 Support skipping Acceptance test cleanup 2024-10-14 13:59:55 +02:00
William Martin
0d7ec44895 Validate required env vars not-empty for Acceptance tests 2024-10-11 18:08:42 +02:00
William Martin
fd66555510 Error if acceptance tests are targeting github or cli orgs 2024-10-11 17:51:17 +02:00
William Martin
9d569b3c11 Isolate acceptance env vars 2024-10-11 16:31:23 +02:00
William Martin
502daff2a1 Refactor acceptance test environment handling 2024-10-11 16:31:22 +02:00
William Martin
5745eb1c1c Add initial acceptance test README 2024-10-11 16:31:22 +02:00
William Martin
99f7e048f9 Support targeting other hosts in acceptance tests 2024-10-11 16:31:22 +02:00
Renamed from acceptance/pr_test.go (Browse further)