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

Stage to master #364

Merged
merged 13 commits into from
Sep 12, 2017
Merged

Stage to master #364

merged 13 commits into from
Sep 12, 2017

Conversation

jerryblakley
Copy link
Contributor

@jerryblakley jerryblakley commented Jul 15, 2017

Add CURLOPT_ERRORBUFFER to capture better error information. However, this may not apply to those '400' errors we were seeing on GET requests, since those are not 'curl errors'.
Also some additions to fusedav tests, as well as expansion of 'server' tests, which are essentially 'externalized' tests to replace python server unit tests.

@jerryblakley
Copy link
Contributor Author

@kf6nux You may have reviewed a few weeks back, but if you have time, can you give it another gander? Thanks. I guess I still have some CircleCI stuff to do as well.

Copy link
Contributor

@kf6nux kf6nux left a comment

Choose a reason for hiding this comment

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

I'd like more context on this. Is there a JIRA card or something else documenting the issue we're debugging?

I left a few comments. Feel free to pick/choose what's relevant/helpful.

Can we squash some of these commits for a cleaner commit history? 😁

src/filecache.c Outdated
@@ -531,7 +531,7 @@ static void get_fresh_fd(filecache_t *cache,
// but on the close (dav_flush/release), the PUT fails and the file never makes it to the server.
// On opening again, the server will deliver this unexpected 404. Changes for forensic-haven
// should prevent these errors in the future (2013-08-29)
if (inject_error(filecache_error_fresh404)) response_code = 404;
if (inject_error(filecache_error_fresh404)) response_code = 400;
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be confusing to inject 400s when checking filecache_error_fresh404.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the changes.

@@ -82,7 +77,7 @@ func testMethod(t *testing.T, testInput TestInput) error {

for _, pair := range testInput.headers {
req.Header.Add(pair.key, pair.value)
fmt.Printf("testMethod: method: %s; path: %s; header: %v\n", testInput.method, testInput.path, req.Header)
fmt.Printf("testMethod: Headers: method: %s; path: %s; header: %v\n", testInput.method, testInput.path, req.Header)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I'm mentally parsing this log line correctly. Why do the labels testMethod: and Headers: not have corresponding fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

testMethod is the name of the function. It's a pattern I use in the fusedav code to list the function name in the log message. Not sure the value here. Leaving it in. As for 'Headers:', this is just an information message, and Headers is just further definition of what the message is conveying.

if testInput.expectedStatusCode != 404 &&
len(testInput.content) > 0 &&
string(body) != testInput.content {
t.Errorf("testMethod: Error, expected content %v, got %v", testInput.content, resp.Body)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to pass string(body) as an argument here instead of resp.Body.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup


testInput.client = getClient()

paths = make([]PathResult, 7)
Copy link
Contributor

Choose a reason for hiding this comment

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

It might read better to use a literal here instead of making and then setting a slice. 💯 for slice/map based tests tho. 😀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

paths[0] is not a constant, and all other values build on it. Not sure how to put together the literal.

testInput.expectedStatusCode = entry.statusCode
err := testMethod(t, testInput)
if err != nil {
// handle error
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if ignoring an error here is going to cause pain in debugging later.

@@ -203,16 +257,16 @@ func TestBasicFileOps(t *testing.T) {
// handle error
}

// Clear the headers
testInput.headers = nil

testInput.method = "GET"
testInput.expectedStatusCode = 200
err = testMethod(t, testInput)
if err != nil {
// handle error
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if ignoring an error here is going to cause pain in debugging later.

* Accommodate comments on previous review; update server tests
@jerryblakley jerryblakley merged commit 8b73c52 into master Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants