Skip to content

Commit

Permalink
Do not warn on 403 received from S3 buckets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorin Buliarca committed Aug 3, 2017
1 parent 62d31b7 commit 69271f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion publishCheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ func (s S3Check) isCurrentOperationFinished(pc *PublishCheck) (operationFinished
defer cleanupResp(resp)

if resp.StatusCode != 200 {
log.Warnf("Checking %s. Error calling URL: [%v] : Response status: [%v]", loggingContextForCheck(pm.config.Alias, pm.UUID, pm.platform, pm.tid), url, resp.Status)
/* for S3 files, we're getting a 403 if the files are not yet in, so we're not warning on that */
if resp.StatusCode != 403 {
log.Warnf("Checking %s. Error calling URL: [%v] : Response status: [%v]", loggingContextForCheck(pm.config.Alias, pm.UUID, pm.platform, pm.tid), url, resp.Status)
}
return false, false
}

Expand Down
8 changes: 8 additions & 0 deletions publishCheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func TestIsCurrentOperationFinished_S3Check_NotFinished(t *testing.T) {
assert.False(t, finished, "operation should not have finished")
}

func TestIsCurrentOperationFinished_S3Check_NotFinished_On_403(t *testing.T) {
s3Check := &S3Check{
mockHTTPCaller(t, "", buildResponse(403, "")),
}
finished, _ := s3Check.isCurrentOperationFinished(NewPublishCheck(PublishMetric{}, "", "", 0, 0, nil))
assert.False(t, finished, "operation should not have finished")
}

func TestIsCurrentOperationFinished_ContentCheck_InvalidContent(t *testing.T) {
currentTid := "tid_1234"
testResponse := `{ "uuid" : "1234-1234"`
Expand Down

0 comments on commit 69271f3

Please sign in to comment.