Skip to content

Commit

Permalink
Update failing tests (#81)
Browse files Browse the repository at this point in the history
* Fixing e2e tests

* Update tests

* Update action versions

* Update cloudflare wrangler action correctly
  • Loading branch information
joseph-flinn authored Dec 17, 2023
1 parent 072b89f commit b334475
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
backend-changed: ${{ steps.changes.outputs.backend-changed }}
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.1

- name: Build Site
run: |
Expand All @@ -66,7 +66,7 @@ jobs:
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.1

- name: Build data
working-directory: data
Expand All @@ -82,10 +82,10 @@ jobs:
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.1

- name: Set up Node
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v4.0.0
with:
cache: 'npm'
cache-dependency-path: 'backend/package-lock.json'
Expand All @@ -97,15 +97,15 @@ jobs:
npm ci
- name: Deploy backend
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@v3.3.2
with:
apiToken: ${{ secrets.CF_API_KEY }}
accountId: ${{ secrets.CF_ACCOUNT }}
workingDirectory: backend
command: deploy --env staging

- name: Run Integration Tests
uses: grafana/[email protected].0
uses: grafana/[email protected].1
env:
ENV: staging
PSK: ${{ secrets.BLOG_ADMIN_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ TOKEN=${TOKEN}
### Testing

```
export TOKEN=<TOKEN FROM BITWARDEN>
k6 -e PSK=${TOKEN} test/script.js
```
10 changes: 4 additions & 6 deletions backend/test/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default function () {

check(res, {
'postsPage: status is 200': (r) => r.status === 200,
'postsPage: formatted correctly': (r) => 'postList' in r.json(),
'postsPage: is not empty': (r) => r.json()['postList'].length != 0
'postsPage: formatted correctly': (r) => 'data' in r.json(),
'postsPage: is not empty': (r) => r.json()['data'].length != 0
})

sleep(SLEEP_TIME) // second
Expand All @@ -49,11 +49,11 @@ export default function () {

check(res, {
'postPage: status is 200': (r) => r.status === 200,
'postPage: formatted correctly': (r) => 'post' in r.json(),
'postPage: formatted correctly': (r) => 'data' in r.json(),
'postPage: contains all metadata': (r) => {
return ['slug', 'title', 'published', 'description', 'body']
.map(key =>
key in r.json()['post']
key in r.json()['data']
)
.reduce((allMetaDataExists, metadataExists) => allMetaDataExists && metadataExists, true);
}
Expand Down Expand Up @@ -106,8 +106,6 @@ export default function () {
'POST - create: verify body': (r) => r.body.includes('create')
})

// newPostId = r.body.

sleep(SLEEP_TIME) // second
})

Expand Down

0 comments on commit b334475

Please sign in to comment.