Repository navigation
fix(cli): one five-minute idle TTL for remote device leases #4220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a6614e2
fix(cli): give cloud device leases a 10 minute TTL
thymikee 74a1be0
test(cli): cover the cloud device lease TTL in the policy
thymikee e336f0a
test(cli): expect the cloud device capability in provider declarations
thymikee 03f7070
fix(cli): one cloud lease TTL rule, validated capability, daemon ceil…
thymikee 8e93466
docs(limrun): state the observed instance inactivity window
thymikee da41a5a
fix(cli): share the five-minute remote device lease TTL with cloud de…
thymikee 884a495
refactor(cli): one five-minute idle TTL for every remote device lease
thymikee 0cf2088
docs(limrun): state the three minute instance inactivity timeout
thymikee 354fbf4
fix(limrun): create instances with the remote lease idle window as in…
thymikee ec35834
test(limrun): expect the inactivity timeout in the Android create input
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { expect, test, vi } from 'vitest'; | ||
| import type { ConnectionProviderCapabilities } from '@agent-device/contracts/remote'; | ||
| import type { RemoteConnectionState } from '@agent-device/remote/remote-connection-state'; | ||
| import { REMOTE_LEASE_IDLE_TTL_MS } from '@agent-device/contracts/lease-scope'; | ||
| import { connectionLeasePolicyForState } from './connection-lease-policy.ts'; | ||
|
|
||
| const LOCAL_PROVIDER: ConnectionProviderCapabilities = { | ||
| leaseKind: 'direct-device-provider', | ||
| requiresAppAttachment: false, | ||
| requiresRemoteDaemon: false, | ||
| supportsArtifacts: false, | ||
| supportsDeferredAppSelection: false, | ||
| supportsDirectPortReverse: false, | ||
| usesCloudWebDriverLease: false, | ||
| }; | ||
|
|
||
| const providers: Record<string, ConnectionProviderCapabilities> = { | ||
| proxy: { ...LOCAL_PROVIDER, leaseKind: 'proxy', requiresRemoteDaemon: true }, | ||
| 'cloud-device': { ...LOCAL_PROVIDER, holdsCloudDevice: true }, | ||
| 'cloud-device-deferred': { | ||
| ...LOCAL_PROVIDER, | ||
| supportsDeferredAppSelection: true, | ||
| holdsCloudDevice: true, | ||
| }, | ||
| 'cloud-webdriver': { ...LOCAL_PROVIDER, usesCloudWebDriverLease: true }, | ||
| 'local-device': LOCAL_PROVIDER, | ||
| 'malformed-flag': { ...LOCAL_PROVIDER, holdsCloudDevice: 'false' as never }, | ||
| }; | ||
|
|
||
| vi.mock('../connection/provider-policy.ts', () => ({ | ||
| connectionProviderCapabilities: (provider: string) => providers[provider], | ||
| })); | ||
|
|
||
| function ttlFor(leaseProvider: string): number | undefined { | ||
| const state = { leaseProvider } as RemoteConnectionState; | ||
| return connectionLeasePolicyForState(state).ttlMs(state); | ||
| } | ||
|
|
||
| test.each([ | ||
| ['proxy', REMOTE_LEASE_IDLE_TTL_MS], | ||
| ['cloud-device', REMOTE_LEASE_IDLE_TTL_MS], | ||
| ['cloud-device-deferred', REMOTE_LEASE_IDLE_TTL_MS], | ||
| ['cloud-webdriver', REMOTE_LEASE_IDLE_TTL_MS], | ||
| ['local-device', undefined], | ||
| ['malformed-flag', undefined], | ||
| ])('a %s lease requests TTL %s', (provider, expected) => { | ||
| expect(ttlFor(provider)).toBe(expected); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.