Skip to content

Commit 05d79db

Browse files
committed
test(product_enablement): Add test suites for all supported products.
All supported products now have test suites which test 'get', 'enable', and 'disable' functionality. This requires using a Compute service for testing as the Fanout product can only be enabled on Compute services. Additionally some small improvements were made in the core product enablement code: unnecessary usage of 'fmt' was removed, and the 'enable' operation now sends the API call with a JSON body instead of a www-form-urlencoded body.
1 parent f1b932f commit 05d79db

39 files changed

+1637
-80
lines changed

fastly/fastly_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,12 @@ var testStatsClient = NewRealtimeStatsClient()
2020
var testDeliveryServiceID = deliveryServiceIDForTest()
2121

2222
// ID of the Compute service for testing.
23-
//
24-
//lint:ignore U1000 this will be used in an upcoming commit
2523
var testComputeServiceID = computeServiceIDForTest()
2624

2725
// ID of the default Delivery service for testing.
2826
var defaultDeliveryTestServiceID = "kKJb5bOFI47uHeBVluGfX1"
2927

3028
// ID of the default Compute service for testing.
31-
//
32-
//lint:ignore U1000 this will be used in an upcoming commit
3329
var defaultComputeTestServiceID = "XsjdElScZGjmfCcTwsYRC1"
3430

3531
const (
@@ -51,7 +47,6 @@ func deliveryServiceIDForTest() string {
5147
return defaultDeliveryTestServiceID
5248
}
5349

54-
//lint:ignore U1000 this will be used in an upcoming commit
5550
func computeServiceIDForTest() string {
5651
if tsid := os.Getenv("FASTLY_TEST_COMPUTE_SERVICE_ID"); tsid != "" {
5752
return tsid

fastly/fixtures/product_enablement/disable_bot_management.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interactions:
66
form: {}
77
headers:
88
User-Agent:
9-
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.20.14)
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
1010
url: https://api.fastly.com/enabled-products/bot_management/services/kKJb5bOFI47uHeBVluGfX1
1111
method: DELETE
1212
response:
@@ -19,7 +19,7 @@ interactions:
1919
Content-Type:
2020
- application/json
2121
Date:
22-
- Tue, 05 Nov 2024 20:38:55 GMT
22+
- Wed, 06 Nov 2024 20:18:24 GMT
2323
Pragma:
2424
- no-cache
2525
Server:
@@ -37,9 +37,9 @@ interactions:
3737
X-Cache-Hits:
3838
- 0, 0
3939
X-Served-By:
40-
- cache-chi-kigq8000069-CHI, cache-nyc-kteb1890025-NYC
40+
- cache-chi-kigq8000069-CHI, cache-ewr-kewr1740064-EWR
4141
X-Timer:
42-
- S1730839134.821062,VS0,VE1506
42+
- S1730924303.402314,VS0,VE1024
4343
status: 204 No Content
4444
code: 204
4545
duration: ""

fastly/fixtures/product_enablement/disable_brotli_compression.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interactions:
66
form: {}
77
headers:
88
User-Agent:
9-
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.20.14)
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
1010
url: https://api.fastly.com/enabled-products/brotli_compression/services/kKJb5bOFI47uHeBVluGfX1
1111
method: DELETE
1212
response:
@@ -19,7 +19,7 @@ interactions:
1919
Content-Type:
2020
- application/json
2121
Date:
22-
- Tue, 05 Nov 2024 20:38:22 GMT
22+
- Wed, 06 Nov 2024 20:18:21 GMT
2323
Pragma:
2424
- no-cache
2525
Server:
@@ -37,9 +37,9 @@ interactions:
3737
X-Cache-Hits:
3838
- 0, 0
3939
X-Served-By:
40-
- cache-chi-kigq8000119-CHI, cache-nyc-kteb1890054-NYC
40+
- cache-chi-kigq8000119-CHI, cache-ewr-kewr1740064-EWR
4141
X-Timer:
42-
- S1730839103.536201,VS0,VE231
42+
- S1730924302.575396,VS0,VE210
4343
status: 204 No Content
4444
code: 204
4545
duration: ""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
10+
url: https://api.fastly.com/enabled-products/domain_inspector/services/kKJb5bOFI47uHeBVluGfX1
11+
method: DELETE
12+
response:
13+
body: ""
14+
headers:
15+
Accept-Ranges:
16+
- bytes
17+
Cache-Control:
18+
- no-store
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Wed, 06 Nov 2024 20:18:23 GMT
23+
Pragma:
24+
- no-cache
25+
Server:
26+
- control-gateway
27+
Status:
28+
- 204 No Content
29+
Strict-Transport-Security:
30+
- max-age=31536000
31+
Vary:
32+
- Accept-Encoding
33+
Via:
34+
- 1.1 varnish, 1.1 varnish
35+
X-Cache:
36+
- MISS, MISS
37+
X-Cache-Hits:
38+
- 0, 0
39+
X-Served-By:
40+
- cache-chi-klot8100037-CHI, cache-ewr-kewr1740064-EWR
41+
X-Timer:
42+
- S1730924303.583736,VS0,VE990
43+
status: 204 No Content
44+
code: 204
45+
duration: ""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
10+
url: https://api.fastly.com/enabled-products/fanout/services/XsjdElScZGjmfCcTwsYRC1
11+
method: DELETE
12+
response:
13+
body: ""
14+
headers:
15+
Accept-Ranges:
16+
- bytes
17+
Cache-Control:
18+
- no-store
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Wed, 06 Nov 2024 20:18:23 GMT
23+
Pragma:
24+
- no-cache
25+
Server:
26+
- control-gateway
27+
Status:
28+
- 204 No Content
29+
Strict-Transport-Security:
30+
- max-age=31536000
31+
Vary:
32+
- Accept-Encoding
33+
Via:
34+
- 1.1 varnish, 1.1 varnish
35+
X-Cache:
36+
- MISS, MISS
37+
X-Cache-Hits:
38+
- 0, 0
39+
X-Served-By:
40+
- cache-chi-kigq8000137-CHI, cache-ewr-kewr1740064-EWR
41+
X-Timer:
42+
- S1730924303.658245,VS0,VE520
43+
status: 204 No Content
44+
code: 204
45+
duration: ""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
10+
url: https://api.fastly.com/enabled-products/image_optimizer/services/kKJb5bOFI47uHeBVluGfX1
11+
method: DELETE
12+
response:
13+
body: ""
14+
headers:
15+
Accept-Ranges:
16+
- bytes
17+
Cache-Control:
18+
- no-store
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Wed, 06 Nov 2024 20:18:25 GMT
23+
Pragma:
24+
- no-cache
25+
Server:
26+
- control-gateway
27+
Status:
28+
- 204 No Content
29+
Strict-Transport-Security:
30+
- max-age=31536000
31+
Vary:
32+
- Accept-Encoding
33+
Via:
34+
- 1.1 varnish, 1.1 varnish
35+
X-Cache:
36+
- MISS, MISS
37+
X-Cache-Hits:
38+
- 0, 0
39+
X-Served-By:
40+
- cache-chi-kigq8000128-CHI, cache-ewr-kewr1740064-EWR
41+
X-Timer:
42+
- S1730924304.279790,VS0,VE1095
43+
status: 204 No Content
44+
code: 204
45+
duration: ""

fastly/fixtures/product_enablement/disable_log_explorer_insights.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interactions:
66
form: {}
77
headers:
88
User-Agent:
9-
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.20.14)
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
1010
url: https://api.fastly.com/enabled-products/log_explorer_insights/services/kKJb5bOFI47uHeBVluGfX1
1111
method: DELETE
1212
response:
@@ -19,7 +19,7 @@ interactions:
1919
Content-Type:
2020
- application/json
2121
Date:
22-
- Tue, 05 Nov 2024 20:38:43 GMT
22+
- Wed, 06 Nov 2024 20:18:25 GMT
2323
Pragma:
2424
- no-cache
2525
Server:
@@ -37,9 +37,9 @@ interactions:
3737
X-Cache-Hits:
3838
- 0, 0
3939
X-Served-By:
40-
- cache-chi-klot8100124-CHI, cache-nyc-kteb1890072-NYC
40+
- cache-chi-klot8100124-CHI, cache-ewr-kewr1740064-EWR
4141
X-Timer:
42-
- S1730839122.120404,VS0,VE884
42+
- S1730924305.931884,VS0,VE831
4343
status: 204 No Content
4444
code: 204
4545
duration: ""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
10+
url: https://api.fastly.com/enabled-products/origin_inspector/services/kKJb5bOFI47uHeBVluGfX1
11+
method: DELETE
12+
response:
13+
body: ""
14+
headers:
15+
Accept-Ranges:
16+
- bytes
17+
Cache-Control:
18+
- no-store
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Wed, 06 Nov 2024 20:18:25 GMT
23+
Pragma:
24+
- no-cache
25+
Server:
26+
- control-gateway
27+
Status:
28+
- 204 No Content
29+
Strict-Transport-Security:
30+
- max-age=31536000
31+
Vary:
32+
- Accept-Encoding
33+
Via:
34+
- 1.1 varnish, 1.1 varnish
35+
X-Cache:
36+
- MISS, MISS
37+
X-Cache-Hits:
38+
- 0, 0
39+
X-Served-By:
40+
- cache-chi-klot8100125-CHI, cache-ewr-kewr1740064-EWR
41+
X-Timer:
42+
- S1730924304.959599,VS0,VE1155
43+
status: 204 No Content
44+
code: 204
45+
duration: ""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
10+
url: https://api.fastly.com/enabled-products/websockets/services/kKJb5bOFI47uHeBVluGfX1
11+
method: DELETE
12+
response:
13+
body: ""
14+
headers:
15+
Accept-Ranges:
16+
- bytes
17+
Cache-Control:
18+
- no-store
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Wed, 06 Nov 2024 20:18:23 GMT
23+
Pragma:
24+
- no-cache
25+
Server:
26+
- control-gateway
27+
Status:
28+
- 204 No Content
29+
Strict-Transport-Security:
30+
- max-age=31536000
31+
Vary:
32+
- Accept-Encoding
33+
Via:
34+
- 1.1 varnish, 1.1 varnish
35+
X-Cache:
36+
- MISS, MISS
37+
X-Cache-Hits:
38+
- 0, 0
39+
X-Served-By:
40+
- cache-chi-klot8100118-CHI, cache-ewr-kewr1740064-EWR
41+
X-Timer:
42+
- S1730924303.978744,VS0,VE427
43+
status: 204 No Content
44+
code: 204
45+
duration: ""

fastly/fixtures/product_enablement/enable_bot_management.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
version: 1
33
interactions:
44
- request:
5-
body: ProductID=bot_management&ServiceID=kKJb5bOFI47uHeBVluGfX1
6-
form:
7-
ProductID:
8-
- bot_management
9-
ServiceID:
10-
- kKJb5bOFI47uHeBVluGfX1
5+
body: '{"ProductID":1,"ServiceID":"kKJb5bOFI47uHeBVluGfX1"}'
6+
form: {}
117
headers:
8+
Accept:
9+
- application/json
1210
Content-Type:
13-
- application/x-www-form-urlencoded
11+
- application/json
1412
User-Agent:
15-
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.20.14)
13+
- FastlyGo/9.11.0 (+github.com/fastly/go-fastly; go1.23.2)
1614
url: https://api.fastly.com/enabled-products/bot_management/services/kKJb5bOFI47uHeBVluGfX1
1715
method: PUT
1816
response:
@@ -28,7 +26,7 @@ interactions:
2826
Content-Type:
2927
- application/json
3028
Date:
31-
- Tue, 05 Nov 2024 20:38:53 GMT
29+
- Wed, 06 Nov 2024 20:18:23 GMT
3230
Pragma:
3331
- no-cache
3432
Server:
@@ -46,9 +44,9 @@ interactions:
4644
X-Cache-Hits:
4745
- 0, 0
4846
X-Served-By:
49-
- cache-chi-kigq8000069-CHI, cache-nyc-kteb1890025-NYC
47+
- cache-chi-kigq8000069-CHI, cache-ewr-kewr1740064-EWR
5048
X-Timer:
51-
- S1730839132.074411,VS0,VE1612
49+
- S1730924301.146435,VS0,VE2136
5250
status: 200 OK
5351
code: 200
5452
duration: ""

0 commit comments

Comments
 (0)