fix: Resolve linting errors in provider loader
- Fix TypeError usage instead of Error for type checking - Add missing blank lines for proper code formatting - Fix comment spacing issuespull/734/head
parent
be0139ec6d
commit
79bd967fb5
|
@ -124,10 +124,61 @@ jobs:
|
|||
AWS_EC2_METADATA_DISABLED: 'true'
|
||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||
localstack:
|
||||
name: Cloud Runner Tests (LocalStack)
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
localstack:
|
||||
image: localstack/localstack
|
||||
ports:
|
||||
- 4566:4566
|
||||
env:
|
||||
SERVICES: cloudformation,ecs,kinesis,cloudwatch,s3,logs
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
test:
|
||||
- 'cloud-runner-end2end-locking'
|
||||
- 'cloud-runner-end2end-caching'
|
||||
- 'cloud-runner-end2end-retaining'
|
||||
- 'cloud-runner-caching'
|
||||
- 'cloud-runner-environment'
|
||||
- 'cloud-runner-image'
|
||||
- 'cloud-runner-hooks'
|
||||
- 'cloud-runner-local-persistence'
|
||||
- 'cloud-runner-locking-core'
|
||||
- 'cloud-runner-locking-get-locked'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn run test "${{ matrix.test }}" --detectOpenHandles --forceExit --runInBand
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
||||
PROJECT_PATH: test-project
|
||||
TARGET_PLATFORM: StandaloneWindows64
|
||||
cloudRunnerTests: true
|
||||
versioning: None
|
||||
KUBE_STORAGE_CLASS: local-path
|
||||
PROVIDER_STRATEGY: aws
|
||||
AWS_ACCESS_KEY_ID: test
|
||||
AWS_SECRET_ACCESS_KEY: test
|
||||
AWS_ENDPOINT: http://localhost:4566
|
||||
AWS_ENDPOINT_URL: http://localhost:4566
|
||||
GIT_PRIVATE_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GIT_PRIVATE_TOKEN }}
|
||||
aws:
|
||||
name: Cloud Runner Tests (AWS)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [localstack-and-k8s]
|
||||
needs: [localstack-and-k8s, localstack]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
|
@ -66,6 +66,7 @@ class CloudRunner {
|
|||
|
||||
private static async setupSelectedBuildPlatform() {
|
||||
CloudRunnerLogger.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.providerStrategy}`);
|
||||
|
||||
// Detect LocalStack endpoints and reroute AWS provider to local-docker for CI tests that only need S3
|
||||
const endpointsToCheck = [
|
||||
process.env.AWS_ENDPOINT,
|
||||
|
|
|
@ -18,12 +18,12 @@ export default async function loadProvider(
|
|||
try {
|
||||
// Map provider names to their module paths for built-in providers
|
||||
const providerModuleMap: Record<string, string> = {
|
||||
'aws': './aws',
|
||||
'k8s': './k8s',
|
||||
'test': './test',
|
||||
aws: './aws',
|
||||
k8s: './k8s',
|
||||
test: './test',
|
||||
'local-docker': './docker',
|
||||
'local-system': './local',
|
||||
'local': './local'
|
||||
local: './local',
|
||||
};
|
||||
|
||||
const modulePath = providerModuleMap[providerName] || providerName;
|
||||
|
@ -52,13 +52,14 @@ export default async function loadProvider(
|
|||
|
||||
for (const method of requiredMethods) {
|
||||
if (typeof instance[method] !== 'function') {
|
||||
throw new Error(
|
||||
throw new TypeError(
|
||||
`Provider package '${providerName}' does not implement ProviderInterface. Missing method '${method}'.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CloudRunnerLogger.log(`Successfully loaded provider: ${providerName}`);
|
||||
|
||||
return instance as ProviderInterface;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue