by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    saafh
    @saafh
    yeah I agree with you... I do not want to test IP address
    Ken’ichiro Oyama
    @k1LoW
    So, you shoud not write its(:private_ip_address) { should eq '10.0.0.0.2' }
    saafh
    @saafh
    but I wrote earlier, that if I skip any one of the line from the describe section, the test fails. It leaves me with no other choice
    if I skip that line completely, my test fails
    Ken’ichiro Oyama
    @k1LoW
    ??? If you ok, please show me test code.
    e.g.
    describe ec2('my-ec2-tag-name') do
      it { should be_running }
      its(:instance_id) { should eq 'i-ec12345a' }
    end
    saafh
    @saafh
    @k1LoW yeah I can show you, how?
    can I share a file with you?
    @k1LoW skype?
    Ken’ichiro Oyama
    @k1LoW
    fail code line only, not all file :+1:
    Could you paste this channel?
    saafh
    @saafh
    ok, it was my mistake... i was using your example without modification... which was reading the whole file/spec... like it 'generate_by_vpc_id generate spec' do
    spec = <<-'EOF'
    but when I separated out the describle part without reading the whole buffer, the tests pass, like you said in the example above
    Ken’ichiro Oyama
    @k1LoW
    :+1:
    saafh
    @saafh
    thanks very much!
    saafh
    @saafh
    @k1LoW I hvae three servers in my consul cluster, with the same Name tag "consul-server" ... in such a case, the test fails
    @k1LoW it means I won't be able to test anything with the same name, is that correct?
    John Reilly Pospos
    @severity1
    @saafh usually i dont test for anything that i know will change, i test for stuff that my Infrastructure as code defines such as tags, names, etc., instead of ips and resource ids.
    if you use autoscaling test the autoscaling group not the actual instance, well, atleast thats my preference.
    and then in my tests i define the state as how i defined it in my infrastructure as code.
    Im not sure if this is the correct approach @k1LoW correct me if I am wrong
    mickey390
    @mickey390
    はじめまして、いつもawspec便利に使わせて頂いています。
    1つ質問があるのですが、
    S3Bucketのhas_cors_ruleですが、
    https://github.com/k1LoW/awspec/blob/f507c3abee1e2501c76941011dba0d78be0129ee/lib/awspec/type/s3_bucket.rb#L41-L53
    以下のような、MaxAgeSecondsやExposeHeaderを
    S3に設定してない状態で、awspecを実行すると、
    AllowedOriginなど他の値が等しくても、
    falseの判定となっているようです。
     <CORSRule>
       <AllowedOrigin>http://www.example.com</AllowedOrigin>
       <AllowedMethod>PUT</AllowedMethod>
       <AllowedMethod>POST</AllowedMethod>
       <AllowedMethod>DELETE</AllowedMethod>
       <AllowedHeader>*</AllowedHeader>
     </CORSRule>
    </CORSConfiguration>
    w3cの仕様では、
    MaxAgeSecondsやExposeHeaderは必須では無いと思っています。
    https://www.w3.org/TR/cors/#access-control-max-age-response-header ご意見頂ければ幸いです。 @k1LoW
    Ken’ichiro Oyama
    @k1LoW
    @mickey390 ご意見ありがとうございます!確かにそのとおりですね
    Ken’ichiro Oyama
    @k1LoW
    @saafh @severity1 If you test same name instance, you can test ID or use with https://github.com/k1LoW/awsrm.
    If you want to more filter, we would encourage you to send a pull request to awsrm :+1:
    Ken’ichiro Oyama
    @k1LoW
    @mickey390 さらに確認しています。has_cors_ruleは特に必須かどうかは関係なく https://github.com/k1LoW/awspec/blob/f507c3abee1e2501c76941011dba0d78be0129ee/spec/type/s3_bucket_spec.rb#L15 のようなテストも書けるはず(として作っている)んですよね。
    そうなると本来のAWSからの返り値と https://github.com/k1LoW/awspec/blob/f507c3abee1e2501c76941011dba0d78be0129ee/lib/awspec/stub/s3_bucket.rb に差があるのかもしれないですね
    mickey390
    @mickey390
    @k1LoW ご確認ありがとうございます。こちらのパターンのスタブありましたね・・!確かにおっしゃるように差がありそうですね、私でもソース落として確認してみます!
    Nick Willever
    @nictrix
    @k1LoW any chance you would reconsider regex in the name fields? k1LoW/awspec#323
    Ken’ichiro Oyama
    @k1LoW
    Hi @nictrix .
    In my opinion
    Regex support is useful. But it may test the wrong resource. So I think awspec should be strict, and awsrm should be useful resource finder.
    If I implement regex support, it's awsrm, not awspec.
    Nick Willever
    @nictrix
    Okay thanks for the explanation
    Tom Elliff
    @tomelliff
    is there a good to assert against something that is in a nested hash?
    something like:
    describe ecs_task_definition('foo') do
      it { should exist }
      it { should be_active }
      its(:family) { should eq 'foo' }
      its(:container_definitions[0]['image']) { should eq 'foo' }
    end
    running the above errors with:
    ...
           expected: "foo"
                got: ecs_task_definition 'foobar'
    ...

    changing to:

    describe ecs_task_definition("#{service_name}-#{environment}") do
      it { should exist }
      it { should be_active }
      its(:family) { should eq "#{service_name}-#{environment}" }
      its(:container_definitions) { should eq "#{service_name}" }
    end

    to see what :container_definitions looks like then gives me the string representation of the struct:

           expected: "foo"
                got: [#<struct Aws::ECS::Types::ContainerDefinition name="foo", image="123456789.dkr.ecr.eu-we...foo", "awslogs-region"=>"eu-west-1", "awslogs-stream-prefix"=>"foo"}>>]
    but it's just the string representation not the actual struct so I can't call to_a on it
    Tom Elliff
    @tomelliff

    also is there a way to check that something doesn't exist or some other matcher?

    describe ecs_service("#{service_name}-#{environment}"), cluster: cluster_name do
      it { should_not exist | be_active }
    end

    throws:

         NotImplementedError:
           `expect(...).not_to matcher.or matcher` is not supported, since it creates a bit of an ambiguity. Instead, define negated versions of whatever matchers you wish to negate with `RSpec::Matchers.define_negated_matcher` and use `expect(...).to matcher.or matcher`.
         # ./test/integration/test_ecs.rb:20:in `block (2 levels) in <top (required)>'

    It looks like the matchers are only exist, have_... and be_... so can't do the above check

    Phillip B. Roberts
    @phillipbroberts
    Is there any documentation on extending AWSpec? For instance we have a set of rules for s3 buckets that are specific to one of our clients, we would like to be able to add these rules into AWSpec with out directly modifying AWSpec? I thought in this particular example I would be able to just add the method to the S3Bucket class but it seems I need to do something more.
    Any pointers would be greatly appreciated
    Ken’ichiro Oyama
    @k1LoW
    @tomelliff Could you check following code?
    its('container_definitions.first.image') { should eq 'foo' }

    @tomelliff

    also is there a way to check that something doesn't exist or some other matcher?

    there is no about or

    Ken’ichiro Oyama
    @k1LoW
    @phillipbroberts
    awspec is just an extension of RSpec . So if you want to extend awspec, learn about RSpec .
    John Reilly Pospos
    @severity1
    a helper script for managing ~/.aws/credentials in an MFA enforced environment. Written in Go: https://gitlab.com/severity1/aws-auth
    my attempt at learning Go
    Brian G. Shacklett
    @bgshacklett
    I'm getting an error stating that the ec2method is not defined. A search showed that I need to require spec_helper as opposed to requiring awspec directly in my tests. I'm having trouble understanding why that works, because that only seems to set up the secrets.yml, which I'm not using. Can anyone help me understand how this is working behind the scenes? Does the generated spec_helper file do more than just configure credentials?
    Brian G. Shacklett
    @bgshacklett
    On further inspection using Pry, it seems like awspec just isn't adding anything to the scope after being required...
    Brian G. Shacklett
    @bgshacklett

    I got past the above; it looks like there's some kind of conflict with Inspec (https://github.com/newcontext-oss/kitchen-terraform/issues/257#issuecomment-409365936)

    I'm running into a lovely undefined method '[]' for nil:NilClass error now, though, even with very simple tests:

    describe ec2(id) do
      it { should exist }
    end
    Mukiza Andrew
    @amukiza

    k1LoW/awspec#391

    Hi folks, I created a pull request to add support for aws_eks and I'd like some feedback. Thanks!

    Mukiza Andrew
    @amukiza
    Looks like generator specs are failing on CI. They passed locally so, I will need to figure out. Still open to feedback regarding the implementation while I fix the doc gen tests.
    Alceu Rodrigues de Freitas Junior
    @glasswalk3r
    Hi! I would like to use in my awspec tests to include validations that uses AWS connection info, like the region and account name. Is there any way I could fetch those details from the connection itself? I used aws configure to setup those.
    Alceu Rodrigues de Freitas Junior
    @glasswalk3r
    Nevermind, I was able to figure out
    Ghost
    @ghost~5c65f72ed73408ce4fb7d853

    Can anybody give me a hand to fix this bug I raised, k1LoW/awspec#443.
    I was not able to push my local bugfix branch to github remote.
    I forked here, had a stab at it, I am not really a ruby dev, here is my commit tozonaran/awspec@4eac251

    Thanks

    Jarryd Took
    @troxil
    Hi team, can someone point me to an order of processing of variables for secrets.yml >> AWS SDK processing (env, ~/.aws/, etc)