Skip to content
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

Support standalone execution of integrations. #131

Open
6 tasks
thantos opened this issue May 15, 2022 · 1 comment
Open
6 tasks

Support standalone execution of integrations. #131

thantos opened this issue May 15, 2022 · 1 comment
Labels

Comments

@thantos
Copy link
Collaborator

thantos commented May 15, 2022

Integrations should be executable outside of resource closures in certain cases for the following use cases:

  • Testing

  • Using logic during synthesis

  • Create standalone integration type

  • Implement standalone for

  • Fail for all other uses

    • Step Function - Illogical, step function returns the execution name, not a result
    • Event Bus - Illogical, what does it mean to submit an event locally?
    • $AWS.* and $SFN.* integrations
  • Support nested standalone integrations

  • Mock integrations

Valid Use:

const sfn = new ExpressionStepFunction<undefined, string>(() => {
    return "hello";
});

const result = sfn();

expect(result).toeEqual({ output: "hello", status: "SUCCEEDED" });

Invalid Use:

const sfn = new StepFunction<undefined, string>(() => {
    return "hello";
});

const result = sfn(); // invalid - what does it mean to start a long running execution locally?

Nested Use

const sfn = new ExpressionStepFunction<undefined, string>(() => {
    return "hello";
});

const sfn2 = new ExpressionStepFunction<undefined, string>(() => {
    return `${sfn()} there`;
});

const result = sfn2();

expect(result).toeEqual({ output: "hello there", status: "SUCCEEDED" });

Invalid nested

const eb = new EventBus();
const sfn = new ExpressionStepFunction<undefined, string>(() => {
    eb();
});

const result = sfn(); // fails, eb() does not support standalone;

Mocked Nested

const eb = new EventBus();
const sfn = new ExpressionStepFunction<undefined, string>(() => {
    eb();
});
mockIntegration(eb, () => {});

const result = sfn(); // success! eb is mocked
@tvanhens
Copy link
Contributor

tvanhens commented Sep 9, 2022

This is a longer term goal but I believe we can offer a similar experience for non-express step functions. Even though they don't return synchronously, we can expose an integration for DescribeExecution. Users could then write async tests locally by polling for the result.

We could do similar things with queues and event buses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants