k1LoW/awspec

Support launch_template resource type.

htnosm opened this issue ยท 12 comments

Hi All,

I would like to test launch_template.
I think that resource type will be added,
however because it has version, It's a bit special.

What would be the best way to do this?
Any ideas?

In many cases, I think that it is a test on the version of "default" or "latest".
How about adding template_version_number to "describe"?
Please refer to #429

Any help will be appreciated.

k1LoW commented

Hi @htnosm !!! Thank you for your proposal !!!

Did you mean following ?

describe launch_template('my-launch-template') do
  its(:template_version_number) { should eq 'default' }
  // or 
  it { should template_version_number('default') }
  // or
  // something
end

I think it is better to implement with a design that is easy for you to use. Because you are first user ๐Ÿฅ‡

If you find more better design, you can ADD more matcher ( not DELETE ) !

Hi @k1LoW ,
Thank you for reply.

What I wrote "special" is the part that specifies the version.
I think that the "describe" part has become a special writing style.

describe launch_template_version('my-launch-template') do
describe launch_template_version('my-launch-template:2') do
                                                    ^^
describe launch_template_version('my-launch-template:latest') do
                                                    ^^^^^^^
k1LoW commented

Oh ! I see ๐Ÿ™

I like launch_template rather than launch_template_version. Because, launch_template have more use case than launch_template_version . ๐Ÿ‘

About "describe()" for awspec

for awspec

"describe()" = AWS Resource Type

In many cases, I think that it is a test on the version of "default" or "latest". is true.
but launch_template_version looks it can test only one type.

Maybe, you might want to test https://github.com/k1LoW/awspec/pull/429/files#diff-6a6f2ef00c5690070d59413e9e975810R11 or https://github.com/k1LoW/awspec/pull/429/files#diff-6a6f2ef00c5690070d59413e9e975810R11

Is it better to give launch_template an attribute of launch_template_version?
launch_template has only basic attributes.
As you said, like EC2 you will want to test image_id etc.
However, it is launch_template_data of launch_template_versions that has those attributes.

k1LoW commented

Is it better to give launch_template an attribute of launch_template_version?

Yes I like.

AWS introduce this resource as "Launch Template" not "Launt Template Version".

We can merge "launch_template_versions attribute" into "launch_template awspec resource type" ๐Ÿ‘

Hi @k1LoW ,
Thank you for support.

I understood it as the following but is this correct?

  • Include launch_template_version in resource type launch_template
  • Test target is default or latest

Please refer to #429 (ba78430)

(Updated aws-sdk-ruby, but checks failed...)

k1LoW commented

Include launch_template_version in resource type launch_template

Yes I like.

Test target is default or latest

I think test target is default only ( by default )

Because awspec is testing framework. so we should make strict comparisons.

If you specify version ( e.g. latest ), How about the following way of writing ?

describe launch_template('my-launch-template'), version: 'latest' do
  // something
end

or

describe launch_template('my-launch-template'), template_version: 'latest' do
  // something
end

This is almost launch_template_version, but I think resource type is Launch Template.

If awspec support S3 Object, include S3 object versioning like launch_template.

ใ„ใ‹ใŒใงใ—ใ‚‡ใ†๏ผŸ

Hi @k1LoW ,
Thank you for support.

That makes sense.
Default if there is no explicit specification.
I will review again.

Hi @k1LoW ,
It updated as follows.

  • Default test target is $Default
  • Other versions of the test specify the version:

Please refer to 201d3de

k1LoW commented

@htnosm Thank you !!!

Hi @k1LoW ,
Thank you for support.

I will close this issue because it has been released.