-
Notifications
You must be signed in to change notification settings - Fork 618
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
Adding fault injection integ tests #4399
Conversation
259981f
to
8891f06
Compare
8891f06
to
b777766
Compare
3a08f40
to
b7c4e29
Compare
99b4d36
to
74c9c67
Compare
ec14c56
to
e046084
Compare
99759b1
to
74252d1
Compare
serverPort = 3333 | ||
) | ||
|
||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit and non-blocking: Using getter functions over var
s is better for long term maintenance since that prevents tests from modifying the originally defined values. Once we have a test that modifies these variables they cannot reliably be used by other tests as constants.
|
||
go func() { | ||
if err := server.Serve(listener); err != nil && err != http.ErrServerClosed { | ||
t.Logf("ListenAndServe(): %s\n", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fail the test here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a require.NoError
58b00f2
to
69f7417
Compare
69f7417
to
467b456
Compare
467b456
to
324a6db
Compare
324a6db
to
56021b3
Compare
Summary
This PR will introduce new integration tests that will tests running the new fault injection endpoints within TMDS in parallel. These tests will only be running for linux and will need sudo permissions to run the utility tools such as
iptables
andtc
Implementation details
getFaultInjectionTaskResponse()
: Helper function to build aTaskResponse
object with fault injection configurations. This will be used during the testsgetHostNetworkInterfaceName()
: helper function that uses theDefaultNetInterfaceName()
function to get the default host network interface name. It is used when constructing theTaskResponse
object ingetFaultInjectionTaskResponse()
getNetworkBlackHolePortRequestBody()
: Getter function to create a request body for network black hole port requestsgetNetworkLatencyRequestBody()
: Getter function to create a request body for network latency requestsgetNetworkPacketLossRequestBody()
: Getter function to create a request body for network packet loss requestsstartServer()
: This function will create and start up a new HTTP server that will include all of the network fault handlers and will create all of the mocks used during the tests.shutdownServer()
: Helper function to stop/shutdown the HTTP server instartServer()
.getURL()
: Helper function to construct the URL of the fault injection endpointscleanupBlackHolePortFault()
: Helper function that will hit the network-black-hole-port/stop endpoints to stop/clean up the black hole port fault on the hostcleanupLatencyAndPacketLossFaults()
: Helper function that will hit both network-latency/stop and network-packet-loss/stop endpoint to clean up both latency and packet loss faults on the hostskipForUnsupportedTc()
: Helper function that tests whether or not thetc
utility installed on the host can use the-j
flag. If it can't then we will skip running the integ testsTesting
Manually ran the tests:
New tests cover the changes: yes
Description for the changelog
Feature: Adding fault injection integration tests
Additional Information
Does this PR include breaking model changes? If so, Have you added transformation functions?
Does this PR include the addition of new environment variables in the README?
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.