Skip to content

Continue recursion for #4687 - #4800

Merged
HyperBrain merged 3 commits into
serverless:masterfrom
bsdkurt:master
Mar 6, 2018
Merged

HyperBrain merged 3 commits into
serverless:masterfrom
bsdkurt:master

Conversation

@bsdkurt

@bsdkurt bsdkurt commented Mar 4, 2018 •

Copy link
Copy Markdown
Contributor

What did you implement:

Additional fix for #4687

How did you implement it:

Continue recursion for populateValue root case.

How can we verify it:

The following serverless.yml can be used to reproduce the problem. Adjust cf reference to an existing stack with an export.

service: test

custom: ${file(custom-properties-${opt:stage, self:provider.stage}.yml)}

provider:
  name: aws
  region: ${self:custom.region}

  environment:
    TEST: ${cf:resources-v1-dev.UserPoolArn}

Todos:

  • Write tests
  • [n/a] Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@erikerikson erikerikson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the right change! 👍 Apologies for my oversight.

Can you add a test case that fails before and success after this change? Otherwise I can add one tomorrow. We have been working our way out of a deficit of use case coverage.

@bsdkurt

bsdkurt commented Mar 4, 2018 •

Copy link
Copy Markdown
Contributor Author

@erikerikson I'm not sure if that is possible. I think this requires that the there be an existing stack that the testing framework has access to. When I had the cf variable pointing to a non-existent stack, the parsing failed before hitting this problem due to the missing stack. Pointers welcome.

Please also see my question on the #4687 bug report. Thanks!

@erikerikson

Copy link
Copy Markdown
Contributor

There is an SSM variable test case that only success if it encounters a specific error. I think related to identifying the case that the parameter does not exist.

However, here I think the problem was that the pre-population of the service left the region in a bad state. This means the test could check that the result of provider.getRegion() returns the expected result following population (or simply checking the source directly). I don't think that the provider environment declaration would need to be part of the service. Also, the custom attribute could be populated from the provider or something other than a file to avoid having to write one out.

@erikerikson

Copy link
Copy Markdown
Contributor

But this is why it is important to ensure you get a failure prior to applying the fix and a success after. To be sure you arranged the circumstance properly. 😄

@bsdkurt

bsdkurt commented Mar 5, 2018 •

Copy link
Copy Markdown
Contributor Author

Thanks for the testing pointers. It will take me a week or so before I can find the time to create the test case (crunch time at work). I'm ok with you pushing ahead without me if you prefer.

@erikerikson

Copy link
Copy Markdown
Contributor

Test offered here: bsdkurt#1

The simplest case of the error was that it had to continue treating the object being populated as the root (and not ignore it - ignoring it is otherwise very important to avoid infinite recursions from self references)

@erikerikson

Copy link
Copy Markdown
Contributor

BTW - go ahead and use n/a in place of an x in the Write Documentation checkbox. This is a non-use-impacting change and thus no docs are needed.

add test that fails prior to the fix in serverless#4800 and succeeds after
@bsdkurt

bsdkurt commented Mar 6, 2018

Copy link
Copy Markdown
Contributor Author

@erikerikson Thank you for providing the test case. I have merged it and updated the todo's as you suggested. Looking forward to 1.27 :-)

@erikerikson

Copy link
Copy Markdown
Contributor

Of course...

Sorry for writing the bug.

Thank you for discovering, debugging, and fixing it!

@HyperBrain should be GTM!

@HyperBrain

Copy link
Copy Markdown
Contributor

@erikerikson Good news! I'll merge.

@HyperBrain HyperBrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 👍 .

@HyperBrain HyperBrain added this to the 1.27 milestone Mar 6, 2018
@HyperBrain
HyperBrain merged commit 5a4d00c into serverless:master Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants