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

add integration tests #90

Merged
merged 10 commits into from
Oct 1, 2020

Conversation

kaisecheng
Copy link
Contributor

@kaisecheng kaisecheng commented Sep 14, 2020

The PR does integration tests against two SNMP dockers with ipv6 to simulate the scenarios below.

  • mix udp tcp
  • multiple hosts
  • snmpv3 connection
  • invalid user
  • multiple inputs with mix tcp udp hosts
  • same security name mix of udp tcp hosts
  • ipv6 connection

- mix udp tcp
- multiple hosts
- snmpv3 connection
- mix udp tcp
- multiple hosts
- snmpv3 connection
- invalid user
- multiple inputs with mix tcp udp hosts
- same security name mix of udp tcp hosts
- ipv6 connection
@colinsurprenant
Copy link
Contributor

Great stuff @kaisecheng! I added a few minor/cosmetic comments. I will be spending more time to run the new testing and followup shortly.

@colinsurprenant
Copy link
Contributor

I believe logstash-plugins/.ci#16 will solve the build problem on 8.0

end
end

describe "against snmp server", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "against snmp server", :integration => true do
describe "against single snmp server with snmpv2 and udp", :integration => true do

it_behaves_like "snmp plugin return single event"
end

describe "against snmpv3 server", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "against snmpv3 server", :integration => true do
describe "against single server with snmpv3 and tcp", :integration => true do

it_behaves_like "snmp plugin return single event"
end

describe "invalid user against snmpv3 server", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "invalid user against snmpv3 server", :integration => true do
describe "invalid user against single server with snmpv3 and tcp", :integration => true do

end
end

describe "single plugin input and mix of udp tcp", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "single plugin input and mix of udp tcp", :integration => true do
describe "single input plugin on single server with snmpv2 and mix of udp and tcp", :integration => true do

plugin.run(queue)
plugin.close

host_cnt_snmp1 = queue.reduce(0) { |sum, event| sum + (event.get("host") == "snmp1"? 1: 0) }
Copy link
Contributor

Choose a reason for hiding this comment

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

would something like this be simpler and/or easier to understand?

host_cnt_snmp1 = queue.select {|event| event.get("host") == "snmp1"}.size

end
end

describe "single plugin input and multiple udp hosts", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "single plugin input and multiple udp hosts", :integration => true do
describe "single input plugin on multiple udp hosts", :integration => true do

plugin.run(queue)
plugin.close

hosts = queue.map { |event| event.get("host") }.sort
Copy link
Contributor

Choose a reason for hiding this comment

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

or this method here could be used instead of my suggestion with select for the sake of consitency?

it_behaves_like "snmp plugin return one udp event and one tcp event", config
end

describe "same security name with different credentials and mix of udp tcp hosts", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "same security name with different credentials and mix of udp tcp hosts", :integration => true do
describe "two plugins on different hosts with snmpv3 with same security name with different credentials and mix of udp and tcp", :integration => true do

it_behaves_like "snmp plugin return one udp event and one tcp event", config
end

describe "ipv6 against snmp1 server", :integration => true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "ipv6 against snmp1 server", :integration => true do
describe "single host with tcp over ipv6 ", :integration => true do

@colinsurprenant
Copy link
Contributor

@kaisecheng again, this is great work, overall LGTM, left a few minor comments. Once these are addressed and this is rebased we should be good to merge!

@colinsurprenant
Copy link
Contributor

Forgot to add for the record that I successfully tested locally on OSX & Docker and it works great and will be a blessing for future testing!!

@kaisecheng kaisecheng merged commit f7d3c5f into logstash-plugins:master Oct 1, 2020
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.

2 participants