Download tasks/format-code-task-000047/tests/test.patch from FineEnvs/MiMo-V2.6-RL-harbor-code: direct link, hf CLI and curl.
- Browser
- Download file 5.84 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000047/tests/test.patch
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/tasks/format-code-task-000047/tests/test.patch
-
curl -L -o test.patch https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000047/tests/test.patch
5.84 kB
| diff --git a/test/imagebuilder.test.ts b/test/imagebuilder.test.ts | |
| index 3c5285b..f56c5a7 100644 | |
| --- a/test/imagebuilder.test.ts | |
| +++ b/test/imagebuilder.test.ts | |
| import * as cdk from 'aws-cdk-lib'; | |
| import { aws_ec2 as ec2 } from 'aws-cdk-lib'; | |
| +import { Template } from 'aws-cdk-lib/assertions'; | |
| import { Architecture, ContainerImageBuilder, Os } from '../src'; | |
| import { AmiBuilder } from '../src/providers/image-builders/ami'; | |
| test('Container image builder supported OS', () => { | |
| }); | |
| }).toThrowError('Unsupported architecture: ARM64. Consider CodeBuild for faster image builds.'); | |
| }); | |
| + | |
| +function countDockerComponents(stack: cdk.Stack): number { | |
| + const template = Template.fromStack(stack); | |
| + const components = template.findResources('AWS::ImageBuilder::Component'); | |
| + let count = 0; | |
| + for (const key of Object.keys(components)) { | |
| + const props = components[key].Properties; | |
| + if (props && props.Description === 'Install latest version of Docker') { | |
| + count += 1; | |
| + } | |
| + } | |
| + return count; | |
| +} | |
| + | |
| + | |
| + | |
| + | |
| + | |
| +function dockerProps(value: boolean): any { | |
| + return { installDocker: value, docker: value }; | |
| +} | |
| + | |
| +test('AMI builder installs Docker by default on Linux', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'linux x64', { | |
| + os: Os.LINUX, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(1); | |
| +}); | |
| + | |
| +test('AMI builder installs Docker by default on Windows', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'win x64', { | |
| + os: Os.WINDOWS, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(1); | |
| +}); | |
| + | |
| +test('AMI builder skips Docker on Windows when installDocker is false', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'win x64', { | |
| + os: Os.WINDOWS, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(false), | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(0); | |
| +}); | |
| + | |
| +test('AMI builder skips Docker on Linux when installDocker is false', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'linux x64', { | |
| + os: Os.LINUX, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(false), | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(0); | |
| +}); | |
| + | |
| +test('AMI builder installs Docker on Windows when installDocker is explicitly true', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'win x64', { | |
| + os: Os.WINDOWS, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(true), | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(1); | |
| +}); | |
| + | |
| +test('AMI builder installs Docker on Linux when installDocker is explicitly true', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'linux x64', { | |
| + os: Os.LINUX, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(true), | |
| + }); | |
| + | |
| + expect(countDockerComponents(stack)).toBe(1); | |
| +}); | |
| + | |
| +test('AMI builder retains non-Docker components when installDocker is false on Windows', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'win x64', { | |
| + os: Os.WINDOWS, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(false), | |
| + }); | |
| + | |
| + const template = Template.fromStack(stack); | |
| + const components = template.findResources('AWS::ImageBuilder::Component'); | |
| + const descriptions = Object.keys(components).map(k => components[k].Properties?.Description); | |
| + | |
| + expect(descriptions).toEqual(expect.arrayContaining([ | |
| + expect.stringMatching(/CloudWatch/), | |
| + 'Install latest version of AWS CLI', | |
| + 'Install latest version of gh', | |
| + 'Install latest version of git', | |
| + 'Install latest version of GitHub Actions Runner', | |
| + ])); | |
| + expect(descriptions).not.toContain('Install latest version of Docker'); | |
| +}); | |
| + | |
| +test('AMI builder retains non-Docker components when installDocker is false on Linux', () => { | |
| + const app = new cdk.App(); | |
| + const stack = new cdk.Stack(app, 'test'); | |
| + const vpc = new ec2.Vpc(stack, 'vpc'); | |
| + | |
| + new AmiBuilder(stack, 'linux x64', { | |
| + os: Os.LINUX, | |
| + architecture: Architecture.X86_64, | |
| + vpc, | |
| + ...dockerProps(false), | |
| + }); | |
| + | |
| + const template = Template.fromStack(stack); | |
| + const components = template.findResources('AWS::ImageBuilder::Component'); | |
| + const descriptions = Object.keys(components).map(k => components[k].Properties?.Description); | |
| + expect(descriptions).toEqual(expect.arrayContaining([ | |
| + 'Install latest version of gh', | |
| + 'Install latest version of git', | |
| + 'Install latest version of GitHub Actions Runner', | |
| + ])); | |
| + expect(descriptions).not.toContain('Install latest version of Docker'); | |
| +}); | |
| diff --git a/test_commands.json b/test_commands.json | |
| new file mode 100644 | |
| index 0000000..b489dc5 | |
| --- /dev/null | |
| +++ b/test_commands.json | |
| +{ | |
| + "test_commands": ["npx jest test/imagebuilder.test.ts --no-coverage"] | |
| +} | |
| diff --git a/mimo_test_command.sh b/mimo_test_command.sh | |
| new file mode 100755 | |
| --- /dev/null | |
| +++ b/mimo_test_command.sh | |
| +#!/usr/bin/env bash | |
| + | |
| +set -uo pipefail | |
| +cd /testbed | |
| +rc=0 | |
| +npx jest test/imagebuilder.test.ts --no-coverage | |
| +rc=$(( rc | $? )) | |
| +exit $rc | |