https://www.puppet.com/community logo
Join Slack
Powered by
# voxpupuli
  • v

    VoxBot

    02/02/2023, 10:35 PM
    yes it would
  • n

    natemccurdy

    02/02/2023, 11:43 PM
    I've got a v4 API ruby function that I'm testing with rspec-puppet. Is there a way to validate that a method in that function is called only once? For example, using
    receive(:method_name).once
    . I'm trying to write an rspec test that verify the caching behavior of this PR: https://github.com/voxpupuli/puppet-vault_lookup/pull/65
  • n

    natemccurdy

    02/02/2023, 11:43 PM
    I've got a v4 API ruby function that I'm testing with rspec-puppet. Is there a way to validate that a method in that function is called only once? For example, using
    receive(:method_name).once
    . I'm trying to write an rspec test that verify the caching behavior of this PR: https://github.com/voxpupuli/puppet-vault_lookup/pull/65
  • n

    natemccurdy

    02/02/2023, 11:58 PM
    Ah, nevermind. Figured it out.
  • y

    Yury Bushmelev

    02/03/2023, 12:24 AM
    Please share your findings! :)
  • n

    natemccurdy

    02/03/2023, 12:35 AM
    Hmm, I got it working but now it's failing rubocop 😞
    Copy code
    allow(function.func).to receive(:get_secret).and_call_original
    result1 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}")
    result2 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}")
    result3 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}")
    
    expect(function.func).to have_received(:get_secret).exactly(1).time
  • n

    natemccurdy

    02/03/2023, 12:35 AM
    The rubocop error is:
    Copy code
    spec/functions/lookup_spec.rb:173:32: C: RSpec/MessageSpies: Prefer receive for setting message expectations. (<http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies>)
          expect(function.func).to have_received(:get_secret).exactly(1).time
                                   ^^^^^^^^^^^^^
  • n

    natemccurdy

    02/03/2023, 12:35 AM
    But if I switch to
    receive
    , the tests don't pass.
  • n

    natemccurdy

    02/03/2023, 12:59 AM
    ah, got it!
    Copy code
    expect(function.func).to receive(:get_secret).and_call_original.exactly(3).times
    result1 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}", 'namespace' => 'foo')
    result2 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}", 'namespace' => 'bar')
    result3 = function.execute('kv/test', 'vault_addr' => "<http://127.0.0.1>:#{port}", 'namespace' => 'baz')
  • n

    natemccurdy

    02/03/2023, 1:01 AM
    Okay, this is ready for a review if anyone's got the time: https://github.com/voxpupuli/puppet-vault_lookup/pull/65
  • n

    natemccurdy

    02/03/2023, 1:01 AM
    Okay, this is ready for a review if anyone's got the time: https://github.com/voxpupuli/puppet-vault_lookup/pull/65
  • j

    jhoblitt

    02/03/2023, 4:23 PM
    The forge says there have been 319 downloads of systemd 4.0.1; no news seems like good news.
  • b

    bastelfreak

    02/03/2023, 4:52 PM
    \o/
  • v

    VoxBot

    02/03/2023, 5:04 PM
    anyone else at fosdem?
  • v

    VoxBot

    02/03/2023, 5:05 PM
    tomorrow around noon
  • v

    VoxBot

    02/03/2023, 5:06 PM
    ewoud: are you at the speakers dinner for cfgmgmtcamp on Sunday?
  • v

    VoxBot

    02/03/2023, 5:06 PM
    I won't do fosdem this year
  • v

    VoxBot

    02/03/2023, 5:09 PM
    bastelfreak: yes
  • v

    VoxBot

    02/03/2023, 5:09 PM
    nice. will see you there then
  • v

    VoxBot

    02/03/2023, 5:09 PM
    jra__: you do cfgmgmtcamp as well?
  • v

    VoxBot

    02/03/2023, 5:10 PM
    I'll be at the Foreman booth most of the time, somewhere in the K building (first floor I think)
  • v

    VoxBot

    02/03/2023, 5:13 PM
    bastelfreak, yes!
  • v

    VoxBot

    02/03/2023, 5:13 PM
    nice!
  • v

    VoxBot

    02/03/2023, 5:14 PM
    sounds like we should organize the social parts in Ghent
  • p

    Pat Riehecky

    02/03/2023, 5:17 PM
    I couldn't get folks to pay for FOSDEM, but I'll be at Red Hat Summit this year
  • b

    bastelfreak

    02/03/2023, 5:19 PM
    where's that?
  • v

    VoxBot

    02/03/2023, 5:21 PM
    I was at Summit, I think in 2019 and that was in Boston
  • v

    VoxBot

    02/03/2023, 5:21 PM
    RH Summit used to switch between Boston and LA I think, but didn't check this year
  • p

    Pat Riehecky

    02/03/2023, 5:21 PM
    It is Boston again this year
  • p

    Pat Riehecky

    02/03/2023, 5:21 PM
    https://www.redhat.com/en/summit for folks needing a link
1...272273274...648Latest