Skip to content

Commit

Permalink
chore: apply some feedback from @lidel
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Sep 25, 2023
1 parent 63df4e1 commit 9ecfe29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/path_gateway_dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestPlainCodec(t *testing.T) {

tests := &SugarTests{}
tests.Append(
helpers.BaseWithRangeTestTransform(t,
helpers.IncludeRangeTests(t,
SugarTest{
Name: Fmt(`GET {{name}} without Accept or format= has expected "{{format}}" Content-Type and body as-is`, row.Name, row.Format),
Hint: `
Expand All @@ -255,7 +255,7 @@ func TestPlainCodec(t *testing.T) {
Fmt("application/{{format}}", row.Format),
)...).
Append(
helpers.BaseWithRangeTestTransform(t,
helpers.IncludeRangeTests(t,
SugarTest{
Name: Fmt("GET {{name}} with ?format= has expected {{format}} Content-Type and body as-is", row.Name, row.Format),
Hint: `
Expand All @@ -275,7 +275,7 @@ func TestPlainCodec(t *testing.T) {
Fmt("application/{{format}}", row.Format),
)...).
Append(
helpers.BaseWithRangeTestTransform(t,
helpers.IncludeRangeTests(t,
SugarTest{
Name: Fmt("GET {{name}} with Accept has expected {{format}} Content-Type and body as-is, with single range request", row.Name, row.Format),
Hint: `
Expand Down
6 changes: 3 additions & 3 deletions tooling/helpers/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func MultiRangeTestTransform(t *testing.T, baseTest test.SugarTest, branges Byte
return rangeTest
}

// BaseWithRangeTestTransform takes a test where there is no "Range" header set in the request, or checks on the
// IncludeRangeTests takes a test where there is no "Range" header set in the request, or checks on the
// StatusCode, Body, or Content-Range headers and verifies whether a valid response is given for the requested ranges.
// Will test the full request, a single range request for the first passed range as well as a multi-range request for
// all the requested ranges.
Expand All @@ -190,7 +190,7 @@ func MultiRangeTestTransform(t *testing.T, baseTest test.SugarTest, branges Byte
// Note: HTTP Range requests can be validly responded with either the full data, or the requested partial data
// Note: HTTP Multi Range requests can be validly responded with one of the full data, the partial data from the first
// range, or the partial data from all the requested ranges
func BaseWithRangeTestTransform(t *testing.T, baseTest test.SugarTest, branges ByteRanges, fullData []byte, contentType string) test.SugarTests {
func IncludeRangeTests(t *testing.T, baseTest test.SugarTest, branges ByteRanges, fullData []byte, contentType string) test.SugarTests {
standardBaseRequest := baseTest.Request.Clone()
if contentType != "" {
standardBaseRequest = standardBaseRequest.Header("Content-Type", contentType)
Expand Down Expand Up @@ -218,7 +218,7 @@ func BaseWithRangeTestTransform(t *testing.T, baseTest test.SugarTest, branges B
// If contentType is empty it is ignored.
//
// If no ranges are passed then some non-overlapping ranges are automatically generated for data >= 10 bytes. Smaller
// data will result in undefined behavior.
// data will produce a panic to avoid undefined behavior.
//
// Note: HTTP Range requests can be validly responded with either the full data, or the requested partial data
// Note: HTTP Multi Range requests can be validly responded with one of the full data, the partial data from the first
Expand Down

0 comments on commit 9ecfe29

Please sign in to comment.