Skip to content

Commit 81eb713

Browse files
authored
chore: test the tests (#22)
* chore: test the tests * chore: auto-release
1 parent 3f27a7a commit 81eb713

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- id: conventionalcommits
22+
name: Conventional Commits
23+
uses: TriPSs/conventional-changelog-action@67139193614f5b9e8db87da1bd4240922b34d765 # v6.0.0
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
skip-commit: "true"
27+
output-file: "false"
28+
create-summary: true
29+
preset: conventionalcommits
30+
31+
- name: Create Release
32+
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
tag_name: ${{ steps.conventionalcommits.outputs.tag }}
37+
release_name: ${{ steps.conventionalcommits.outputs.tag }}
38+
body: ${{ steps.conventionalcommits.outputs.clean_changelog }}

.github/workflows/test.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
- reopened
12+
13+
jobs:
14+
build:
15+
name: Conventional pull request names
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
build-test:
23+
name: Build & Test
24+
if: ${{ github.event.pull_request.draft == false }}
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
submodules: true
30+
- name: Set up Go
31+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
32+
with:
33+
go-version-file: "go.mod"
34+
- name: Set up gotestfmt
35+
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
36+
- name: Build
37+
run: go build ./...
38+
- run: go test -json -v -p 1 ./... | gotestfmt

internal/clientcredentials/service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ func TestHandleTokenRequest(t *testing.T) {
8787
wantStatus: http.StatusUnauthorized,
8888
},
8989
{
90-
name: "missing required scope in basic auth",
90+
name: "unexpected scope in basic auth",
9191
setupRequest: func() *http.Request {
9292
form := url.Values{}
9393
form.Set("grant_type", "client_credentials")
94-
form.Set("scope", "read") // missing write scope
94+
form.Set("scope", "unknown") // missing write scope
9595

9696
req := httptest.NewRequest(http.MethodPost, "/token", strings.NewReader(form.Encode()))
9797
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

0 commit comments

Comments
 (0)