Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -2,9 +2,7 @@ import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
clearGitCapabilityStateForTests,
|
||||
getLocalGitCapabilityCache,
|
||||
getSshGitCapabilityCache,
|
||||
LOCAL_GIT_CAPABILITY_HOST_KEY_MAX_BYTES,
|
||||
LOCAL_GIT_CAPABILITY_HOST_MAX_ENTRIES
|
||||
getSshGitCapabilityCache
|
||||
} from './git-capability-state'
|
||||
|
||||
describe('Git capability execution-host state', () => {
|
||||
@@ -36,27 +34,4 @@ describe('Git capability execution-host state', () => {
|
||||
getSshGitCapabilityCache(replacementProvider)
|
||||
)
|
||||
})
|
||||
|
||||
it('evicts the oldest local execution host after the host ceiling', () => {
|
||||
const oldest = getLocalGitCapabilityCache({ wslDistro: 'Distro-0' })
|
||||
let newest = oldest
|
||||
for (let index = 1; index <= LOCAL_GIT_CAPABILITY_HOST_MAX_ENTRIES; index++) {
|
||||
newest = getLocalGitCapabilityCache({ wslDistro: `Distro-${index}` })
|
||||
}
|
||||
|
||||
expect(getLocalGitCapabilityCache({ wslDistro: 'Distro-0' })).not.toBe(oldest)
|
||||
expect(
|
||||
getLocalGitCapabilityCache({
|
||||
wslDistro: `Distro-${LOCAL_GIT_CAPABILITY_HOST_MAX_ENTRIES}`
|
||||
})
|
||||
).toBe(newest)
|
||||
})
|
||||
|
||||
it('does not retain oversized execution-host keys', () => {
|
||||
const oversizedDistro = 'x'.repeat(LOCAL_GIT_CAPABILITY_HOST_KEY_MAX_BYTES + 1)
|
||||
|
||||
expect(getLocalGitCapabilityCache({ wslDistro: oversizedDistro })).not.toBe(
|
||||
getLocalGitCapabilityCache({ wslDistro: oversizedDistro })
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user