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

udprunner + build improvements + timeout changes #452

Merged
merged 11 commits into from Jan 28, 2021
Merged

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Jan 27, 2021

Fixes #446

}

// Close closes the last connection and returns the total number of sockets used for the run.
func (c *UDPClient) Close() int {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 3 locations. Consider refactoring.

return &c, nil
}

func (c *UDPClient) connect() (net.Conn, error) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

Method UDPClient.Fetch has 8 return statements (exceeds 4 allowed).


// RunUDPTest runs an tcp test and returns the aggregated stats.
// Some refactoring to avoid copy-pasta between the now 3 runners would be good.
func RunUDPTest(o *RunnerOptions) (*RunnerResults, error) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Jan 27, 2021

Code Climate has analyzed commit bc5d1ea and detected 13 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 7
Style 3

View more on Code Climate.

}

// NewUDPClient creates and initialize and returns a client based on the UDPOptions.
func NewUDPClient(o *UDPOptions) (*UDPClient, error) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.


// Run tests tcp request fetching. Main call being run at the target QPS.
// To be set as the Function in RunnerOptions.
func (udpstate *RunnerResults) Run(t int) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

Method UDPClient.Fetch has 53 lines of code (exceeds 50 allowed). Consider refactoring.


// RunUDPTest runs an tcp test and returns the aggregated stats.
// Some refactoring to avoid copy-pasta between the now 3 runners would be good.
func RunUDPTest(o *RunnerOptions) (*RunnerResults, error) {
Copy link

Choose a reason for hiding this comment

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

Function RunUDPTest has 52 lines of code (exceeds 50 allowed). Consider refactoring.


// TODO: this quite the search and replace tcp->udp from tcprunner/ - refactor?

type UDPResultMap map[string]int64
Copy link

Choose a reason for hiding this comment

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

exported type UDPResultMap should have comment or be unexported

@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #452 (62aa5c0) into master (7245d29) will decrease coverage by 0.6%.
The diff coverage is 69.7%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #452     +/-   ##
========================================
- Coverage    86.7%   86.2%   -0.6%     
========================================
  Files          25      26      +1     
  Lines        2860    2982    +122     
========================================
+ Hits         2480    2569     +89     
- Misses        252     271     +19     
- Partials      128     142     +14     
Impacted Files Coverage Δ
tcprunner/tcprunner.go 69.7% <ø> (ø)
udprunner/udprunner.go 69.7% <69.7%> (ø)
fhttp/http_client.go 80.5% <0.0%> (+0.9%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7245d29...7edf9f5. Read the comment docs.

errMismatch = fmt.Errorf("read not echoing writes")
)

// Generates a 24 bytes unique payload for each runner thread and message sent.
Copy link

Choose a reason for hiding this comment

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

comment on exported function GeneratePayload should be of the form "GeneratePayload ..."

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

exported method UDPClient.Fetch should have comment or be unexported

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

Method UDPClient.Fetch has 9 return statements (exceeds 4 allowed).

return socket, nil
}

func (c *UDPClient) Fetch() ([]byte, error) {
Copy link

Choose a reason for hiding this comment

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

Method UDPClient.Fetch has 56 lines of code (exceeds 50 allowed). Consider refactoring.


// TODO: this quite the search and replace udp->udp from tcprunner/ - refactor?

var UDPTimeOutDefaultValue = 750 * time.Millisecond
Copy link

Choose a reason for hiding this comment

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

exported var UDPTimeOutDefaultValue should have comment or be unexported

@ldemailly ldemailly merged commit 22d4307 into master Jan 28, 2021
@ldemailly ldemailly deleted the udprunner2 branch January 28, 2021 06:38
@ldemailly ldemailly changed the title wip udprunner. for now copy-pasta/rename tcp->udp udprunner + build improvements + timeout changes Jan 28, 2021
@ldemailly ldemailly mentioned this pull request Jan 29, 2021
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.

UDP runner
1 participant