Skip to content

Commit

Permalink
test(riff-raff.yaml): Add a failing test for riff-raff.yaml generation
Browse files Browse the repository at this point in the history
Adds the test case for different GuStacks across multiple AWS accounts.

Co-authored-by: Jacob <[email protected]>
Co-authored-by: Thalia <[email protected]>
  • Loading branch information
3 people committed Jan 19, 2023
1 parent 912b4b3 commit fc4ad52
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/experimental/riff-raff-yaml-file/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,60 @@ import { GuEc2App, GuScheduledLambda } from "../../patterns";
import { RiffRaffYamlFileExperimental } from "./index";

describe("The RiffRaffYamlFileExperimental class", () => {
it("Should support deploying different GuStack to multiple AWS accounts (aka Riff-Raff stacks)", () => {
const app = new App({ outdir: "/tmp/cdk.out" });

class ServiceRunningInDeployTools extends GuStack {}
class ServiceRunningInSecurity extends GuStack {}
const region = {
env: {
region: "eu-west-1",
},
};

new ServiceRunningInDeployTools(app, "App-CODE-deploy", {
...region,
stack: "deploy",
stage: "CODE",
});
new ServiceRunningInSecurity(app, "App-CODE-security", {
...region,
stack: "security",
stage: "CODE",
});

const actual = new RiffRaffYamlFileExperimental(app).toYAML();

expect(actual).toMatchInlineSnapshot(`
"allowedStages:
- CODE
deployments:
cfn-eu-west-1-deploy-service-running-in-deploy-tools:
type: cloud-formation
regions:
- eu-west-1
stacks:
- deploy
app: service-running-in-deploy-tools
contentDirectory: /tmp/cdk.out
parameters:
templateStagePaths:
CODE: App-CODE-deploy.template.json
cfn-eu-west-1-security-service-running-in-security:
type: cloud-formation
regions:
- eu-west-1
stacks:
- security
app: service-running-in-security
contentDirectory: /tmp/cdk.out
parameters:
templateStagePaths:
CODE: App-CODE-security.template.json
"
`);
});

it("Should throw when there are missing stack definitions", () => {
const app = new App();

Expand Down

0 comments on commit fc4ad52

Please sign in to comment.