Skip to content

Commit 4a5dad7

Browse files
committed
remove probes, update acceptance tests
1 parent 68f5331 commit 4a5dad7

6 files changed

Lines changed: 20 additions & 195 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,21 @@ jobs:
3232
- run: npm ci
3333
- name: unit tests
3434
run: npm test
35-
- name: acceptance tests
35+
- name: acceptance tests (macOS/Windows)
36+
if: runner.os != 'Linux'
3637
env:
3738
ACCEPTANCE_TESTS: 'true'
3839
run: npm run test:acceptance
39-
- name: probe macOS for 'security' command
40-
run: npm run probe:macos
41-
- name: probe Windows for Windows Credential Manager
42-
if: runner.os == 'Windows'
43-
run: npm run probe:windows
44-
- name: probe Linux for 'secret-tool' command
45-
run: npm run probe:linux
40+
- name: acceptance tests (Linux)
41+
if: runner.os == 'Linux'
42+
env:
43+
ACCEPTANCE_TESTS: 'true'
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install -y libsecret-tools gnome-keyring
47+
dbus-run-session -- bash -c '
48+
eval "$(echo -n "heroku-credential-manager-ci" | gnome-keyring-daemon --unlock --components=secrets 2>/dev/null)"
49+
npm run test:acceptance
50+
'
4651
- name: linting
4752
run: npm run lint

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@
6767
"lint": "tsc -p test --noEmit && eslint .",
6868
"prepublishOnly": "npm run build",
6969
"prepare": "npm run build",
70-
"probe:linux": "bash scripts/ci/probe-linux.sh",
71-
"probe:macos": "bash scripts/ci/probe-macos.sh",
72-
"probe:windows": "powershell -NoProfile -File scripts/ci/probe-windows.ps1",
7370
"test": "c8 --reporter=text-summary --check-coverage mocha --forbid-only --ignore \"test/credential-manager/acceptance/**\" \"test/**/*.test.ts\"",
7471
"test:acceptance": "c8 mocha --forbid-only \"test/credential-manager/acceptance/**/*.test.ts\"",
7572
"test:file": "c8 mocha",

scripts/ci/probe-linux.sh

Lines changed: 0 additions & 75 deletions
This file was deleted.

scripts/ci/probe-macos.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

scripts/ci/probe-windows.ps1

Lines changed: 0 additions & 54 deletions
This file was deleted.

test/credential-manager/acceptance/index.acceptance.test.ts

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,72 +119,49 @@ describe('credential-manager', function () {
119119
})
120120

121121
describe('native credential store with netrc', function () {
122-
let restoreNetrc: (() => void) | undefined
123-
124-
before(function () {
125-
const temp = setupTempNetrcDir()
126-
restoreNetrc = temp.restore
127-
})
128-
129-
after(function () {
130-
if (restoreNetrc) {
131-
restoreNetrc()
132-
}
133-
})
134-
135122
afterEach(async function () {
136123
for (const credential of Object.values(CREDENTIAL_FIXTURES)) {
137124
try {
138125
// eslint-disable-next-line no-await-in-loop
139-
await credentialManager.removeAuth(credential.account, credential.hosts, credential.service)
126+
await credentialManager.removeAuth(credential.account, [], credential.service)
140127
} catch {
141128
// ignore cleanup errors
142129
}
143130
}
144131
})
145132

146133
it('saves and retrieves a credential', async function () {
147-
console.log('=== made it to "saves and retrieves a credential" ===')
148134
const credential = CREDENTIAL_FIXTURES['account-default']
149135
await credentialManager.saveAuth(
150136
credential.account,
151137
credential.token,
152-
credential.hosts,
138+
[],
153139
credential.service,
154140
)
155141

156-
console.log('=== made it to "saveAuth" ===')
157-
158142
const token = await credentialManager.getAuth(
159143
credential.account,
160-
credential.hosts[0],
144+
'',
161145
credential.service,
162146
)
163147

164-
console.log('=== made it to "getAuth" ===')
165-
166148
expect(token).to.equal(credential.token)
167149
})
168150

169151
it('removes a credential', async function () {
170-
console.log('=== made it to "removes a credential" ===')
171152
const credential = CREDENTIAL_FIXTURES['account-default']
172153
await credentialManager.saveAuth(
173154
credential.account,
174155
credential.token,
175-
credential.hosts,
156+
[],
176157
credential.service,
177158
)
178159

179-
console.log('=== made it to "saveAuth" ===')
180-
181-
await credentialManager.removeAuth(credential.account, credential.hosts, credential.service)
182-
183-
console.log('=== made it to "removeAuth" ===')
160+
await credentialManager.removeAuth(credential.account, [], credential.service)
184161

185162
await expect(
186-
credentialManager.getAuth(credential.account, credential.hosts[0], credential.service),
187-
).to.be.rejectedWith(Error, `No auth found for ${credential.hosts[0]}`)
163+
credentialManager.getAuth(credential.account, '', credential.service),
164+
).to.be.rejected
188165
})
189166
})
190167
})

0 commit comments

Comments
 (0)