databricks-cli/libs
shreyas-goenka f71583fbc0
Error when unknown API endpoint is used in testserver (#2292)
## Changes
This PR fails the acceptance test when an unknown endpoint (i.e. not
stubbed) is used. We want to ensure that all API endpoints used in an
acceptance test are stubbed and do not otherwise silently fail with a
404.

The logs on failure output include a configuration that developers can
simply copy-paste to `test.toml` to stub the missing API endpoint. It'll
look something like:
```
[[Server]]
Pattern = "<method> <path>"
Response.Body = '''
<response body here>
'''
Response.StatusCode = <response status-code here>
```


## Tests
Manually:

output.txt when an endpoint is not found: 
```
>>> [CLI] jobs create --json {"name":"abc"}
Error: No stub found for pattern: POST /api/2.1/jobs/create
```

How this renders in the test logs:
```
    --- FAIL: TestAccept/workspace/jobs/create (0.03s)
        server.go:46: 
            
            ----------------------------------------
            No stub found for pattern: POST /api/2.1/jobs/create
            
            To stub a response for this request, you can add
            the following to test.toml:
            [[Server]]
            Pattern = "POST /api/2.1/jobs/create"
            Response.Body = '''
            <response body here>
            '''
            Response.StatusCode = <response status-code here>
            ----------------------------------------
```

Manually checked that the debug mode still works.
2025-02-07 16:26:48 +00:00
..
auth Add `auth.Env` function (#2204) 2025-01-22 12:14:54 +00:00
cmdgroup Add error checking in tests and enable errcheck there (#1980) 2024-12-09 13:56:41 +01:00
cmdio Refactor `bundle init` (#2074) 2025-01-20 12:09:28 +00:00
databrickscfg Refactor `bundle init` (#2074) 2025-01-20 12:09:28 +00:00
dbr Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
diag Encourage the use of root_path in production to ensure single deployment (#1712) 2025-01-13 12:19:12 +00:00
dyn Added support for double underscore variable references (#2203) 2025-01-29 13:38:28 +00:00
env Add acceptance tests (#2081) 2025-01-08 12:41:08 +00:00
errs Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
exec exec(test): Do not clear PATH; this breaks coverage on Windows (#2150) 2025-01-15 12:05:46 +01:00
fakefs Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
filer Bump github.com/databricks/databricks-sdk-go from 0.55.0 to 0.56.1 (#2238) 2025-01-27 13:11:07 +00:00
fileset Enable testifylint and fix the issues (#2065) 2025-01-02 12:03:41 +01:00
flags Always print warnings and errors; clean up format (#2213) 2025-02-07 11:29:40 +00:00
folders Enable testifylint and fix the issues (#2065) 2025-01-02 12:03:41 +01:00
git Bump github.com/databricks/databricks-sdk-go from 0.55.0 to 0.56.1 (#2238) 2025-01-27 13:11:07 +00:00
iamutil Move utility functions dealing with IAM to libs/iamutil (#1820) 2024-10-10 13:02:25 +00:00
jsonschema Allow 'any' examples in JSON schema (#2289) 2025-02-06 19:27:55 +00:00
locker Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
log Always print warnings and errors; clean up format (#2213) 2025-02-07 11:29:40 +00:00
notebook Format Python code with ruff (#2166) 2025-01-17 07:38:47 +00:00
process Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
python libs/python: Remove DetectInterpreters (#2234) 2025-01-27 13:22:08 +00:00
set Show actionable errors for collaborative deployment scenarios (#1386) 2024-10-10 11:18:23 +00:00
sync Format Python code with ruff (#2166) 2025-01-17 07:38:47 +00:00
tags Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
telemetry Add protos for bundle telemetry (#2209) 2025-01-29 11:49:53 +00:00
template Refactor `bundle init` (#2074) 2025-01-20 12:09:28 +00:00
terraform Move to a single prompt during bundle destroy (#1583) 2024-07-24 13:02:19 +00:00
testdiff Add ability to record headers in acceptance tests (#2296) 2025-02-05 09:32:15 +00:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00
testserver Error when unknown API endpoint is used in testserver (#2292) 2025-02-07 16:26:48 +00:00
textutil Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
vfs Enable testifylint and fix the issues (#2065) 2025-01-02 12:03:41 +01:00