| 1 | Description: disable all tests that needs network access or that work with invalid |
| 2 | certifiicates. |
| 3 | Author: Thorsten Alteholz <[email protected]> |
| 4 | Index: golang-github-sethvargo-go-fastly/fastly/acl_entries_batch_test.go |
| 5 | =================================================================== |
| 6 | --- golang-github-sethvargo-go-fastly.orig/fastly/acl_entries_batch_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 7 | +++ golang-github-sethvargo-go-fastly/fastly/acl_entries_batch_test.go 2019-08-22 12:58:18.573955416 +0000 |
| 8 | @@ -1,350 +1,8 @@ |
| 9 | package fastly |
| 10 | |
| 11 | import ( |
| 12 | - "sort" |
| 13 | "testing" |
| 14 | ) |
| 15 | |
| 16 | -func TestClient_BatchModifyAclEntries_Create(t *testing.T) { |
| 17 | - |
| 18 | - fixtureBase := "acl_entries_batch/create/" |
| 19 | - nameSuffix := "BatchModifyAclEntries_Create" |
| 20 | - |
| 21 | - // Given: a test service with an ACL and a batch of create operations, |
| 22 | - testService := createTestService(t, fixtureBase+"create_service", nameSuffix) |
| 23 | - defer deleteTestService(t, fixtureBase+"delete_service", testService.ID) |
| 24 | - |
| 25 | - testVersion := createTestVersion(t, fixtureBase+"create_version", testService.ID) |
| 26 | - |
| 27 | - testACL := createTestACL(t, fixtureBase+"create_acl", testService.ID, testVersion.Number, nameSuffix) |
| 28 | - defer deleteTestACL(t, testACL, fixtureBase+"delete_acl") |
| 29 | - |
| 30 | - batchCreateOperations := &BatchModifyACLEntriesInput{ |
| 31 | - Service: testService.ID, |
| 32 | - ACL: testACL.ID, |
| 33 | - Entries: []*BatchACLEntry{ |
| 34 | - { |
| 35 | - Operation: CreateBatchOperation, |
| 36 | - IP: "127.0.0.1", |
| 37 | - Subnet: "24", |
| 38 | - Negated: false, |
| 39 | - Comment: "ACL Entry 1", |
| 40 | - }, |
| 41 | - { |
| 42 | - Operation: CreateBatchOperation, |
| 43 | - IP: "192.168.0.1", |
| 44 | - Subnet: "24", |
| 45 | - Negated: false, |
| 46 | - Comment: "ACL Entry 2", |
| 47 | - }, |
| 48 | - }, |
| 49 | - } |
| 50 | - |
| 51 | - // When: I execute the batch create operations against the Fastly API, |
| 52 | - var err error |
| 53 | - record(t, fixtureBase+"create_acl_entries", func(c *Client) { |
| 54 | - |
| 55 | - err = c.BatchModifyACLEntries(batchCreateOperations) |
| 56 | - }) |
| 57 | - if err != nil { |
| 58 | - t.Fatal(err) |
| 59 | - } |
| 60 | - |
| 61 | - // Then: I expect to be able to list all of the created ACL entries. |
| 62 | - var actualACLEntries []*ACLEntry |
| 63 | - record(t, fixtureBase+"list_after_create", func(c *Client) { |
| 64 | - actualACLEntries, err = c.ListACLEntries(&ListACLEntriesInput{ |
| 65 | - Service: testService.ID, |
| 66 | - ACL: testACL.ID, |
| 67 | - }) |
| 68 | - }) |
| 69 | - if err != nil { |
| 70 | - t.Fatal(err) |
| 71 | - } |
| 72 | - |
| 73 | - sort.Slice(actualACLEntries, func(i, j int) bool { |
| 74 | - return actualACLEntries[i].IP < actualACLEntries[j].IP |
| 75 | - }) |
| 76 | - |
| 77 | - actualNumberOfACLEntries := len(actualACLEntries) |
| 78 | - expectedNumberOfACLEntries := len(batchCreateOperations.Entries) |
| 79 | - if actualNumberOfACLEntries != expectedNumberOfACLEntries { |
| 80 | - t.Errorf("Incorrect number of ACL entries returned, expected: %d, got %d", expectedNumberOfACLEntries, actualNumberOfACLEntries) |
| 81 | - } |
| 82 | - |
| 83 | - for i, entry := range actualACLEntries { |
| 84 | - |
| 85 | - actualIp := entry.IP |
| 86 | - expectedIp := batchCreateOperations.Entries[i].IP |
| 87 | - |
| 88 | - if actualIp != expectedIp { |
| 89 | - t.Errorf("IP did not match, expected %s, got %s", expectedIp, actualIp) |
| 90 | - } |
| 91 | - |
| 92 | - actualSubnet := entry.Subnet |
| 93 | - expectedSubnet := batchCreateOperations.Entries[i].Subnet |
| 94 | - |
| 95 | - if actualSubnet != expectedSubnet { |
| 96 | - t.Errorf("Subnet did not match, expected %s, got %s", expectedSubnet, actualSubnet) |
| 97 | - } |
| 98 | - |
| 99 | - actualNegated := entry.Negated |
| 100 | - expectedNegated := batchCreateOperations.Entries[i].Negated |
| 101 | - |
| 102 | - if actualNegated != expectedNegated { |
| 103 | - t.Errorf("Negated did not match, expected %t, got %t", expectedNegated, actualNegated) |
| 104 | - } |
| 105 | - |
| 106 | - actualComment := entry.Comment |
| 107 | - expectedComment := batchCreateOperations.Entries[i].Comment |
| 108 | - |
| 109 | - if actualComment != expectedComment { |
| 110 | - t.Errorf("Comment did not match, expected %s, got %s", expectedComment, actualComment) |
| 111 | - } |
| 112 | - } |
| 113 | - |
| 114 | -} |
| 115 | - |
| 116 | -func TestClient_BatchModifyAclEntries_Delete(t *testing.T) { |
| 117 | - |
| 118 | - fixtureBase := "acl_entries_batch/delete/" |
| 119 | - nameSuffix := "BatchModifyAclEntries_Delete" |
| 120 | - |
| 121 | - // Given: a test service with an ACL and a batch of create operations, |
| 122 | - testService := createTestService(t, fixtureBase+"create_service", nameSuffix) |
| 123 | - defer deleteTestService(t, fixtureBase+"delete_service", testService.ID) |
| 124 | - |
| 125 | - testVersion := createTestVersion(t, fixtureBase+"create_version", testService.ID) |
| 126 | - |
| 127 | - testACL := createTestACL(t, fixtureBase+"create_acl", testService.ID, testVersion.Number, nameSuffix) |
| 128 | - defer deleteTestACL(t, testACL, fixtureBase+"delete_acl") |
| 129 | - |
| 130 | - batchCreateOperations := &BatchModifyACLEntriesInput{ |
| 131 | - Service: testService.ID, |
| 132 | - ACL: testACL.ID, |
| 133 | - Entries: []*BatchACLEntry{ |
| 134 | - { |
| 135 | - Operation: CreateBatchOperation, |
| 136 | - IP: "127.0.0.1", |
| 137 | - Subnet: "24", |
| 138 | - Negated: false, |
| 139 | - Comment: "ACL Entry 1", |
| 140 | - }, |
| 141 | - { |
| 142 | - Operation: CreateBatchOperation, |
| 143 | - IP: "192.168.0.1", |
| 144 | - Subnet: "24", |
| 145 | - Negated: false, |
| 146 | - Comment: "ACL Entry 2", |
| 147 | - }, |
| 148 | - }, |
| 149 | - } |
| 150 | - |
| 151 | - var err error |
| 152 | - record(t, fixtureBase+"create_acl_entries", func(c *Client) { |
| 153 | - |
| 154 | - err = c.BatchModifyACLEntries(batchCreateOperations) |
| 155 | - }) |
| 156 | - if err != nil { |
| 157 | - t.Fatal(err) |
| 158 | - } |
| 159 | - |
| 160 | - var createdACLEntries []*ACLEntry |
| 161 | - record(t, fixtureBase+"list_before_delete", func(client *Client) { |
| 162 | - createdACLEntries, err = client.ListACLEntries(&ListACLEntriesInput{ |
| 163 | - Service: testService.ID, |
| 164 | - ACL: testACL.ID, |
| 165 | - }) |
| 166 | - }) |
| 167 | - if err != nil { |
| 168 | - t.Fatal(err) |
| 169 | - } |
| 170 | - |
| 171 | - sort.Slice(createdACLEntries, func(i, j int) bool { |
| 172 | - return createdACLEntries[i].IP < createdACLEntries[j].IP |
| 173 | - }) |
| 174 | - |
| 175 | - // When: I execute the batch delete operations against the Fastly API, |
| 176 | - batchDeleteOperations := &BatchModifyACLEntriesInput{ |
| 177 | - Service: testService.ID, |
| 178 | - ACL: testACL.ID, |
| 179 | - Entries: []*BatchACLEntry{ |
| 180 | - { |
| 181 | - Operation: DeleteBatchOperation, |
| 182 | - ID: createdACLEntries[0].ID, |
| 183 | - }, |
| 184 | - }, |
| 185 | - } |
| 186 | - |
| 187 | - record(t, fixtureBase+"delete_acl_entries", func(c *Client) { |
| 188 | - |
| 189 | - err = c.BatchModifyACLEntries(batchDeleteOperations) |
| 190 | - }) |
| 191 | - if err != nil { |
| 192 | - t.Fatal(err) |
| 193 | - } |
| 194 | - |
| 195 | - // Then: I expect to be able to list a single ACL entry. |
| 196 | - var actualACLEntries []*ACLEntry |
| 197 | - record(t, fixtureBase+"list_after_delete", func(client *Client) { |
| 198 | - actualACLEntries, err = client.ListACLEntries(&ListACLEntriesInput{ |
| 199 | - Service: testService.ID, |
| 200 | - ACL: testACL.ID, |
| 201 | - }) |
| 202 | - }) |
| 203 | - if err != nil { |
| 204 | - t.Fatal(err) |
| 205 | - } |
| 206 | - |
| 207 | - sort.Slice(actualACLEntries, func(i, j int) bool { |
| 208 | - return actualACLEntries[i].IP < actualACLEntries[j].IP |
| 209 | - }) |
| 210 | - |
| 211 | - actualNumberOfACLEntries := len(actualACLEntries) |
| 212 | - expectedNumberOfACLEntries := len(batchDeleteOperations.Entries) |
| 213 | - if actualNumberOfACLEntries != expectedNumberOfACLEntries { |
| 214 | - t.Errorf("Incorrect number of ACL entries returned, expected: %d, got %d", expectedNumberOfACLEntries, actualNumberOfACLEntries) |
| 215 | - } |
| 216 | -} |
| 217 | - |
| 218 | func TestClient_BatchModifyAclEntries_Update(t *testing.T) { |
| 219 | - |
| 220 | - fixtureBase := "acl_entries_batch/update/" |
| 221 | - nameSuffix := "BatchModifyAclEntries_Update" |
| 222 | - |
| 223 | - // Given: a test service with an ACL and ACL entries, |
| 224 | - testService := createTestService(t, fixtureBase+"create_service", nameSuffix) |
| 225 | - defer deleteTestService(t, fixtureBase+"delete_service", testService.ID) |
| 226 | - |
| 227 | - testVersion := createTestVersion(t, fixtureBase+"create_version", testService.ID) |
| 228 | - |
| 229 | - testACL := createTestACL(t, fixtureBase+"create_acl", testService.ID, testVersion.Number, nameSuffix) |
| 230 | - defer deleteTestACL(t, testACL, fixtureBase+"delete_acl") |
| 231 | - |
| 232 | - batchCreateOperations := &BatchModifyACLEntriesInput{ |
| 233 | - Service: testService.ID, |
| 234 | - ACL: testACL.ID, |
| 235 | - Entries: []*BatchACLEntry{ |
| 236 | - { |
| 237 | - Operation: CreateBatchOperation, |
| 238 | - IP: "127.0.0.1", |
| 239 | - Subnet: "24", |
| 240 | - Negated: false, |
| 241 | - Comment: "ACL Entry 1", |
| 242 | - }, |
| 243 | - { |
| 244 | - Operation: CreateBatchOperation, |
| 245 | - IP: "192.168.0.1", |
| 246 | - Subnet: "24", |
| 247 | - Negated: false, |
| 248 | - Comment: "ACL Entry 2", |
| 249 | - }, |
| 250 | - }, |
| 251 | - } |
| 252 | - |
| 253 | - var err error |
| 254 | - record(t, fixtureBase+"create_acl_entries", func(c *Client) { |
| 255 | - |
| 256 | - err = c.BatchModifyACLEntries(batchCreateOperations) |
| 257 | - }) |
| 258 | - if err != nil { |
| 259 | - t.Fatal(err) |
| 260 | - } |
| 261 | - |
| 262 | - var createdACLEntries []*ACLEntry |
| 263 | - record(t, fixtureBase+"list_before_update", func(client *Client) { |
| 264 | - createdACLEntries, err = client.ListACLEntries(&ListACLEntriesInput{ |
| 265 | - Service: testService.ID, |
| 266 | - ACL: testACL.ID, |
| 267 | - }) |
| 268 | - }) |
| 269 | - if err != nil { |
| 270 | - t.Fatal(err) |
| 271 | - } |
| 272 | - |
| 273 | - sort.Slice(createdACLEntries, func(i, j int) bool { |
| 274 | - return createdACLEntries[i].IP < createdACLEntries[j].IP |
| 275 | - }) |
| 276 | - |
| 277 | - // When: I execute the batch update operations against the Fastly API, |
| 278 | - batchUpdateOperations := &BatchModifyACLEntriesInput{ |
| 279 | - Service: testService.ID, |
| 280 | - ACL: testACL.ID, |
| 281 | - Entries: []*BatchACLEntry{ |
| 282 | - { |
| 283 | - Operation: UpdateBatchOperation, |
| 284 | - ID: createdACLEntries[0].ID, |
| 285 | - IP: "127.0.0.2", |
| 286 | - Subnet: "16", |
| 287 | - Negated: true, |
| 288 | - Comment: "Updated ACL Entry 1", |
| 289 | - }, |
| 290 | - }, |
| 291 | - } |
| 292 | - |
| 293 | - record(t, fixtureBase+"update_acl_entries", func(c *Client) { |
| 294 | - |
| 295 | - err = c.BatchModifyACLEntries(batchUpdateOperations) |
| 296 | - }) |
| 297 | - if err != nil { |
| 298 | - t.Fatal(err) |
| 299 | - } |
| 300 | - |
| 301 | - // Then: I expect to be able to list all of the ACL entries with modifications applied to a single item. |
| 302 | - var actualACLEntries []*ACLEntry |
| 303 | - record(t, fixtureBase+"list_after_update", func(client *Client) { |
| 304 | - actualACLEntries, err = client.ListACLEntries(&ListACLEntriesInput{ |
| 305 | - Service: testService.ID, |
| 306 | - ACL: testACL.ID, |
| 307 | - }) |
| 308 | - }) |
| 309 | - if err != nil { |
| 310 | - t.Fatal(err) |
| 311 | - } |
| 312 | - |
| 313 | - sort.Slice(actualACLEntries, func(i, j int) bool { |
| 314 | - return actualACLEntries[i].IP < actualACLEntries[j].IP |
| 315 | - }) |
| 316 | - |
| 317 | - actualNumberOfAclEntries := len(actualACLEntries) |
| 318 | - expectedNumberOfAclEntries := len(batchCreateOperations.Entries) |
| 319 | - if actualNumberOfAclEntries != expectedNumberOfAclEntries { |
| 320 | - t.Errorf("Incorrect number of ACL entries returned, expected: %d, got %d", expectedNumberOfAclEntries, actualNumberOfAclEntries) |
| 321 | - } |
| 322 | - |
| 323 | - actualID := actualACLEntries[0].ID |
| 324 | - expectedID := batchUpdateOperations.Entries[0].ID |
| 325 | - |
| 326 | - if actualID != expectedID { |
| 327 | - t.Errorf("First ID did not match, expected %s, got %s", expectedID, actualID) |
| 328 | - } |
| 329 | - |
| 330 | - actualIP := actualACLEntries[0].IP |
| 331 | - expectedIP := batchUpdateOperations.Entries[0].IP |
| 332 | - |
| 333 | - if actualIP != expectedIP { |
| 334 | - t.Errorf("First IP did not match, expected %s, got %s", expectedIP, actualIP) |
| 335 | - } |
| 336 | - |
| 337 | - actualSubnet := actualACLEntries[0].Subnet |
| 338 | - expectedSubnet := batchUpdateOperations.Entries[0].Subnet |
| 339 | - |
| 340 | - if actualSubnet != expectedSubnet { |
| 341 | - t.Errorf("First Subnet did not match, expected %s, got %s", expectedSubnet, actualSubnet) |
| 342 | - } |
| 343 | - |
| 344 | - actualNegated := actualACLEntries[0].Negated |
| 345 | - expectedNegated := batchUpdateOperations.Entries[0].Negated |
| 346 | - |
| 347 | - if actualNegated != expectedNegated { |
| 348 | - t.Errorf("First Subnet did not match, expected %t, got %t", expectedNegated, actualNegated) |
| 349 | - } |
| 350 | - |
| 351 | - actualComment := actualACLEntries[0].Comment |
| 352 | - expectedComment := batchUpdateOperations.Entries[0].Comment |
| 353 | - |
| 354 | - if actualComment != expectedComment { |
| 355 | - t.Errorf("First Comment did not match, expected %s, got %s", expectedComment, actualComment) |
| 356 | - } |
| 357 | - |
| 358 | -} |
| 359 | \ No newline at end of file |
| 360 | +} |
| 361 | Index: golang-github-sethvargo-go-fastly/fastly/acl_test.go |
| 362 | =================================================================== |
| 363 | --- golang-github-sethvargo-go-fastly.orig/fastly/acl_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 364 | +++ golang-github-sethvargo-go-fastly/fastly/acl_test.go 2019-08-22 12:50:43.029698989 +0000 |
| 365 | @@ -3,111 +3,6 @@ |
| 366 | import "testing" |
| 367 | |
| 368 | func TestClient_ACLs(t *testing.T) { |
| 369 | - t.Parallel() |
| 370 | - |
| 371 | - fixtureBase := "acls/" |
| 372 | - |
| 373 | - testVersion := createTestVersion(t, fixtureBase+"version", testServiceID) |
| 374 | - |
| 375 | - // Create |
| 376 | - var err error |
| 377 | - var a *ACL |
| 378 | - record(t, fixtureBase+"create", func(c *Client) { |
| 379 | - a, err = c.CreateACL(&CreateACLInput{ |
| 380 | - Service: testServiceID, |
| 381 | - Version: testVersion.Number, |
| 382 | - Name: "test_acl", |
| 383 | - }) |
| 384 | - }) |
| 385 | - if err != nil { |
| 386 | - t.Fatal(err) |
| 387 | - } |
| 388 | - |
| 389 | - // Ensure deleted |
| 390 | - defer func() { |
| 391 | - record(t, fixtureBase+"cleanup", func(c *Client) { |
| 392 | - c.DeleteACL(&DeleteACLInput{ |
| 393 | - Service: testServiceID, |
| 394 | - Version: testVersion.Number, |
| 395 | - Name: "test_acl", |
| 396 | - }) |
| 397 | - |
| 398 | - c.DeleteACL(&DeleteACLInput{ |
| 399 | - Service: testServiceID, |
| 400 | - Version: testVersion.Number, |
| 401 | - Name: "new_test_acl", |
| 402 | - }) |
| 403 | - }) |
| 404 | - }() |
| 405 | - |
| 406 | - if a.Name != "test_acl" { |
| 407 | - t.Errorf("bad name: %q", a.Name) |
| 408 | - } |
| 409 | - |
| 410 | - // List |
| 411 | - var as []*ACL |
| 412 | - record(t, fixtureBase+"list", func(c *Client) { |
| 413 | - as, err = c.ListACLs(&ListACLsInput{ |
| 414 | - Service: testServiceID, |
| 415 | - Version: testVersion.Number, |
| 416 | - }) |
| 417 | - }) |
| 418 | - if err != nil { |
| 419 | - t.Fatal(err) |
| 420 | - } |
| 421 | - if len(as) != 1 { |
| 422 | - t.Errorf("bad ACLs: %v", as) |
| 423 | - } |
| 424 | - |
| 425 | - // Get |
| 426 | - var na *ACL |
| 427 | - record(t, fixtureBase+"get", func(c *Client) { |
| 428 | - na, err = c.GetACL(&GetACLInput{ |
| 429 | - Service: testServiceID, |
| 430 | - Version: testVersion.Number, |
| 431 | - Name: "test_acl", |
| 432 | - }) |
| 433 | - }) |
| 434 | - if err != nil { |
| 435 | - t.Fatal(err) |
| 436 | - } |
| 437 | - if a.Name != na.Name { |
| 438 | - t.Errorf("bad name: %q (%q)", a.Name, na.Name) |
| 439 | - } |
| 440 | - |
| 441 | - // Update |
| 442 | - var ua *ACL |
| 443 | - record(t, fixtureBase+"update", func(c *Client) { |
| 444 | - ua, err = c.UpdateACL(&UpdateACLInput{ |
| 445 | - Service: testServiceID, |
| 446 | - Version: testVersion.Number, |
| 447 | - Name: "test_acl", |
| 448 | - NewName: "new_test_acl", |
| 449 | - }) |
| 450 | - }) |
| 451 | - if err != nil { |
| 452 | - t.Fatal(err) |
| 453 | - } |
| 454 | - if ua.Name != "new_test_acl" { |
| 455 | - t.Errorf("Bad name after update %s", ua.Name) |
| 456 | - } |
| 457 | - |
| 458 | - if a.ID != ua.ID { |
| 459 | - t.Errorf("bad ACL id: %q (%q)", a.ID, ua.ID) |
| 460 | - } |
| 461 | - |
| 462 | - // Delete |
| 463 | - record(t, fixtureBase+"delete", func(c *Client) { |
| 464 | - err = c.DeleteACL(&DeleteACLInput{ |
| 465 | - Service: testServiceID, |
| 466 | - Version: testVersion.Number, |
| 467 | - Name: "new_test_acl", |
| 468 | - }) |
| 469 | - }) |
| 470 | - if err != nil { |
| 471 | - t.Fatal(err) |
| 472 | - } |
| 473 | - |
| 474 | } |
| 475 | |
| 476 | func TestClient_ListACLs_validation(t *testing.T) { |
| 477 | Index: golang-github-sethvargo-go-fastly/fastly/dictionary_item_batch_test.go |
| 478 | =================================================================== |
| 479 | --- golang-github-sethvargo-go-fastly.orig/fastly/dictionary_item_batch_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 480 | +++ golang-github-sethvargo-go-fastly/fastly/dictionary_item_batch_test.go 2019-08-22 12:49:26.890313343 +0000 |
| 481 | @@ -6,369 +6,5 @@ |
| 482 | |
| 483 | |
| 484 | |
| 485 | -func TestClient_BatchModifyDictionaryItems_Create(t *testing.T) { |
| 486 | - |
| 487 | - fixtureBase := "dictionary_items_batch/create/" |
| 488 | - nameSuffix := "BatchModifyDictionaryItems_Create" |
| 489 | - |
| 490 | - // Given: a test service with a dictionary and a batch of create operations, |
| 491 | - testService := createTestService(t, fixtureBase + "create_service", nameSuffix) |
| 492 | - defer deleteTestService(t, fixtureBase +"delete_service", testService.ID) |
| 493 | - |
| 494 | - testVersion := createTestVersion(t,fixtureBase + "create_version", testService.ID) |
| 495 | - |
| 496 | - testDictionary := createTestDictionary(t, fixtureBase + "create_dictionary", testService.ID, testVersion.Number, nameSuffix) |
| 497 | - defer deleteTestDictionary(t, testDictionary, fixtureBase + "delete_dictionary") |
| 498 | - |
| 499 | - batchCreateOperations := &BatchModifyDictionaryItemsInput { |
| 500 | - Service: testService.ID, |
| 501 | - Dictionary: testDictionary.ID, |
| 502 | - Items: []*BatchDictionaryItem{ |
| 503 | - { |
| 504 | - Operation: CreateBatchOperation, |
| 505 | - ItemKey: "key1", |
| 506 | - ItemValue: "val1", |
| 507 | - }, |
| 508 | - { |
| 509 | - Operation: CreateBatchOperation, |
| 510 | - ItemKey: "key2", |
| 511 | - ItemValue: "val2", |
| 512 | - }, |
| 513 | - }, |
| 514 | - } |
| 515 | - |
| 516 | - // When: I execute the batch create operations against the Fastly API, |
| 517 | - var err error |
| 518 | - record(t, fixtureBase + "create_dictionary_items", func(c *Client) { |
| 519 | - |
| 520 | - err = c.BatchModifyDictionaryItems(batchCreateOperations) |
| 521 | - }) |
| 522 | - if err != nil { |
| 523 | - t.Fatal(err) |
| 524 | - } |
| 525 | - |
| 526 | - // Then: I expect to be able to list all of the created dictionary items. |
| 527 | - var actualDictionaryItems []*DictionaryItem |
| 528 | - record(t, fixtureBase + "list_after_create", func(c *Client) { |
| 529 | - actualDictionaryItems, err = c.ListDictionaryItems(&ListDictionaryItemsInput{ |
| 530 | - Service: testService.ID, |
| 531 | - Dictionary: testDictionary.ID, |
| 532 | - }) |
| 533 | - }) |
| 534 | - if err != nil { |
| 535 | - t.Fatal(err) |
| 536 | - } |
| 537 | - |
| 538 | - actualNumberOfDictItems := len(actualDictionaryItems) |
| 539 | - expectedNumberOfDictItems := len(batchCreateOperations.Items) |
| 540 | - if actualNumberOfDictItems != expectedNumberOfDictItems { |
| 541 | - t.Errorf("Incorrect number of dictionary items returned, expected: %d, got %d", expectedNumberOfDictItems, actualNumberOfDictItems) |
| 542 | - } |
| 543 | - |
| 544 | - for i, item := range actualDictionaryItems { |
| 545 | - |
| 546 | - actualItemKey := item.ItemKey |
| 547 | - expectedItemKey := batchCreateOperations.Items[i].ItemKey |
| 548 | - if actualItemKey != expectedItemKey { |
| 549 | - t.Errorf("First ItemKey did not match, expected %s, got %s", expectedItemKey, actualItemKey) |
| 550 | - } |
| 551 | - |
| 552 | - actualItemValue := item.ItemValue |
| 553 | - expectedItemValue := batchCreateOperations.Items[i].ItemValue |
| 554 | - if actualItemValue != expectedItemValue { |
| 555 | - t.Errorf("First ItemValue did not match, expected %s, got %s", expectedItemValue, actualItemValue) |
| 556 | - } |
| 557 | - |
| 558 | - } |
| 559 | - |
| 560 | -} |
| 561 | - |
| 562 | -func TestClient_BatchModifyDictionaryItems_Delete(t *testing.T) { |
| 563 | - |
| 564 | - fixtureBase := "dictionary_items_batch/delete/" |
| 565 | - nameSuffix := "BatchModifyDictionaryItems_Delete" |
| 566 | - |
| 567 | - // Given: a test service with a dictionary and dictionary items, |
| 568 | - testService := createTestService(t, fixtureBase + "create_service", nameSuffix) |
| 569 | - defer deleteTestService(t, fixtureBase + "delete_service", testService.ID) |
| 570 | - |
| 571 | - testVersion := createTestVersion(t,fixtureBase + "create_version", testService.ID) |
| 572 | - |
| 573 | - testDictionary := createTestDictionary(t, fixtureBase + "create_dictionary", testService.ID, testVersion.Number, nameSuffix) |
| 574 | - defer deleteTestDictionary(t, testDictionary, fixtureBase + "delete_dictionary") |
| 575 | - |
| 576 | - batchCreateOperations := &BatchModifyDictionaryItemsInput { |
| 577 | - Service: testService.ID, |
| 578 | - Dictionary: testDictionary.ID, |
| 579 | - Items: []*BatchDictionaryItem{ |
| 580 | - { |
| 581 | - Operation: CreateBatchOperation, |
| 582 | - ItemKey: "key1", |
| 583 | - ItemValue: "val1", |
| 584 | - }, |
| 585 | - { |
| 586 | - Operation: CreateBatchOperation, |
| 587 | - ItemKey: "key2", |
| 588 | - ItemValue: "val2", |
| 589 | - }, |
| 590 | - }, |
| 591 | - } |
| 592 | - |
| 593 | - var err error |
| 594 | - record(t, fixtureBase + "create_dictionary_items", func(c *Client) { |
| 595 | - |
| 596 | - err = c.BatchModifyDictionaryItems(batchCreateOperations) |
| 597 | - }) |
| 598 | - if err != nil { |
| 599 | - t.Fatal(err) |
| 600 | - } |
| 601 | - |
| 602 | - // When: I execute the batch delete operations against the Fastly API, |
| 603 | - batchDeleteOperations := &BatchModifyDictionaryItemsInput { |
| 604 | - Service: testService.ID, |
| 605 | - Dictionary: testDictionary.ID, |
| 606 | - Items: []*BatchDictionaryItem{ |
| 607 | - { |
| 608 | - Operation: DeleteBatchOperation, |
| 609 | - ItemKey: "key2", |
| 610 | - ItemValue: "val2", |
| 611 | - }, |
| 612 | - }, |
| 613 | - } |
| 614 | - |
| 615 | - record(t, fixtureBase + "delete_dictionary_items", func(c *Client) { |
| 616 | - |
| 617 | - err = c.BatchModifyDictionaryItems(batchDeleteOperations) |
| 618 | - }) |
| 619 | - if err != nil { |
| 620 | - t.Fatal(err) |
| 621 | - } |
| 622 | - |
| 623 | - // Then: I expect to be able to list a single dictionary item. |
| 624 | - var actualDictionaryItems []*DictionaryItem |
| 625 | - record(t, fixtureBase + "list_after_delete", func(client *Client) { |
| 626 | - actualDictionaryItems, err = client.ListDictionaryItems(&ListDictionaryItemsInput{ |
| 627 | - Service: testService.ID, |
| 628 | - Dictionary: testDictionary.ID, |
| 629 | - }) |
| 630 | - }) |
| 631 | - if err != nil { |
| 632 | - t.Fatal(err) |
| 633 | - } |
| 634 | - |
| 635 | - actualNumberOfDictItems := len(actualDictionaryItems) |
| 636 | - expectedNumberOfDictItems := len(batchDeleteOperations.Items) |
| 637 | - if actualNumberOfDictItems != expectedNumberOfDictItems { |
| 638 | - t.Errorf("Incorrect number of dictionary items returned, expected: %d, got %d", expectedNumberOfDictItems, actualNumberOfDictItems) |
| 639 | - } |
| 640 | -} |
| 641 | - |
| 642 | -func TestClient_BatchModifyDictionaryItems_Update(t *testing.T) { |
| 643 | - |
| 644 | - fixtureBase := "dictionary_items_batch/update/" |
| 645 | - nameSuffix := "BatchModifyDictionaryItems_Update" |
| 646 | - |
| 647 | - // Given: a test service with a dictionary and dictionary items, |
| 648 | - testService := createTestService(t, fixtureBase + "create_service", nameSuffix) |
| 649 | - defer deleteTestService(t, fixtureBase + "delete_service", testService.ID) |
| 650 | - |
| 651 | - testVersion := createTestVersion(t,fixtureBase + "create_version", testService.ID) |
| 652 | - |
| 653 | - testDictionary := createTestDictionary(t, fixtureBase + "create_dictionary", testService.ID, testVersion.Number, nameSuffix) |
| 654 | - defer deleteTestDictionary(t, testDictionary, fixtureBase + "delete_dictionary") |
| 655 | - |
| 656 | - batchCreateOperations := &BatchModifyDictionaryItemsInput { |
| 657 | - Service: testService.ID, |
| 658 | - Dictionary: testDictionary.ID, |
| 659 | - Items: []*BatchDictionaryItem{ |
| 660 | - { |
| 661 | - Operation: CreateBatchOperation, |
| 662 | - ItemKey: "key1", |
| 663 | - ItemValue: "val1", |
| 664 | - }, |
| 665 | - { |
| 666 | - Operation: CreateBatchOperation, |
| 667 | - ItemKey: "key2", |
| 668 | - ItemValue: "val2", |
| 669 | - }, |
| 670 | - }, |
| 671 | - } |
| 672 | - |
| 673 | - var err error |
| 674 | - record(t, fixtureBase + "create_dictionary_items", func(c *Client) { |
| 675 | - |
| 676 | - err = c.BatchModifyDictionaryItems(batchCreateOperations) |
| 677 | - }) |
| 678 | - if err != nil { |
| 679 | - t.Fatal(err) |
| 680 | - } |
| 681 | - |
| 682 | - // When: I execute the batch update operations against the Fastly API, |
| 683 | - batchUpdateOperations := &BatchModifyDictionaryItemsInput { |
| 684 | - Service: testService.ID, |
| 685 | - Dictionary: testDictionary.ID, |
| 686 | - Items: []*BatchDictionaryItem{ |
| 687 | - { |
| 688 | - Operation: UpdateBatchOperation, |
| 689 | - ItemKey: "key2", |
| 690 | - ItemValue: "val2Updated", |
| 691 | - }, |
| 692 | - }, |
| 693 | - } |
| 694 | - |
| 695 | - record(t, fixtureBase + "update_dictionary_items", func(c *Client) { |
| 696 | - |
| 697 | - err = c.BatchModifyDictionaryItems(batchUpdateOperations) |
| 698 | - }) |
| 699 | - if err != nil { |
| 700 | - t.Fatal(err) |
| 701 | - } |
| 702 | - |
| 703 | - // Then: I expect to be able to list all of the dictionary items with modifications applied to a single item. |
| 704 | - var actualDictionaryItems []*DictionaryItem |
| 705 | - record(t, fixtureBase + "list_after_update", func(c *Client) { |
| 706 | - actualDictionaryItems, err = c.ListDictionaryItems(&ListDictionaryItemsInput{ |
| 707 | - Service: testService.ID, |
| 708 | - Dictionary: testDictionary.ID, |
| 709 | - }) |
| 710 | - }) |
| 711 | - if err != nil { |
| 712 | - t.Fatal(err) |
| 713 | - } |
| 714 | - |
| 715 | - actualNumberOfDictItems := len(actualDictionaryItems) |
| 716 | - expectedNumberOfDictItems := len(batchCreateOperations.Items) |
| 717 | - if actualNumberOfDictItems != expectedNumberOfDictItems { |
| 718 | - t.Errorf("Incorrect number of dictionary items returned, expected: %d, got %d", expectedNumberOfDictItems, actualNumberOfDictItems) |
| 719 | - } |
| 720 | - |
| 721 | - actualItemKey := actualDictionaryItems[0].ItemKey |
| 722 | - expectedItemKey := batchCreateOperations.Items[0].ItemKey |
| 723 | - |
| 724 | - if actualItemKey != expectedItemKey { |
| 725 | - t.Errorf("First ItemKey did not match, expected %s, got %s", expectedItemKey, actualItemKey) |
| 726 | - } |
| 727 | - |
| 728 | - actualItemValue := actualDictionaryItems[0].ItemValue |
| 729 | - expectedItemValue := batchCreateOperations.Items[0].ItemValue |
| 730 | - |
| 731 | - |
| 732 | - // Confirm the second dictionary item contains the modifications. |
| 733 | - if actualItemValue != expectedItemValue { |
| 734 | - t.Errorf("First ItemValue did not match, expected %s, got %s", expectedItemValue, actualItemValue) |
| 735 | - } |
| 736 | - |
| 737 | - actualItemKey = actualDictionaryItems[1].ItemKey |
| 738 | - expectedItemKey = batchUpdateOperations.Items[0].ItemKey |
| 739 | - |
| 740 | - if actualItemKey != expectedItemKey { |
| 741 | - t.Errorf("Second ItemKey did not match, expected %s, got %s", expectedItemKey, actualItemKey) |
| 742 | - } |
| 743 | - |
| 744 | - actualItemValue = actualDictionaryItems[1].ItemValue |
| 745 | - expectedItemValue = batchUpdateOperations.Items[0].ItemValue |
| 746 | - |
| 747 | - |
| 748 | - if actualItemValue != expectedItemValue { |
| 749 | - t.Errorf("Second ItemValue did not match, expected %s, got %s", expectedItemValue, actualItemValue) |
| 750 | - } |
| 751 | - |
| 752 | -} |
| 753 | - |
| 754 | func TestClient_BatchModifyDictionaryItems_Upsert(t *testing.T) { |
| 755 | - |
| 756 | - fixtureBase := "dictionary_items_batch/upsert/" |
| 757 | - nameSuffix := "BatchModifyDictionaryItems_Upsert" |
| 758 | - |
| 759 | - // Given: a test service with a dictionary and dictionary items, |
| 760 | - testService := createTestService(t, fixtureBase + "create_service", nameSuffix) |
| 761 | - defer deleteTestService(t, fixtureBase + "delete_service", testService.ID) |
| 762 | - |
| 763 | - testVersion := createTestVersion(t,fixtureBase + "create_version", testService.ID) |
| 764 | - |
| 765 | - testDictionary := createTestDictionary(t, fixtureBase + "create_dictionary", testService.ID, testVersion.Number, nameSuffix) |
| 766 | - defer deleteTestDictionary(t, testDictionary, fixtureBase + "delete_dictionary") |
| 767 | - |
| 768 | - batchCreateOperations := &BatchModifyDictionaryItemsInput { |
| 769 | - Service: testService.ID, |
| 770 | - Dictionary: testDictionary.ID, |
| 771 | - Items: []*BatchDictionaryItem{ |
| 772 | - { |
| 773 | - Operation: CreateBatchOperation, |
| 774 | - ItemKey: "key1", |
| 775 | - ItemValue: "val1", |
| 776 | - }, |
| 777 | - }, |
| 778 | - } |
| 779 | - |
| 780 | - var err error |
| 781 | - record(t, fixtureBase + "create_dictionary_items", func(c *Client) { |
| 782 | - |
| 783 | - err = c.BatchModifyDictionaryItems(batchCreateOperations) |
| 784 | - }) |
| 785 | - if err != nil { |
| 786 | - t.Fatal(err) |
| 787 | - } |
| 788 | - |
| 789 | - // When: I execute the batch upsert operations against the Fastly API |
| 790 | - batchUpsertOperations := &BatchModifyDictionaryItemsInput { |
| 791 | - Service: testService.ID, |
| 792 | - Dictionary: testDictionary.ID, |
| 793 | - Items: []*BatchDictionaryItem{ |
| 794 | - { |
| 795 | - Operation: UpsertBatchOperation, |
| 796 | - ItemKey: "key1", |
| 797 | - ItemValue: "val1Updated", |
| 798 | - }, |
| 799 | - { |
| 800 | - Operation: UpsertBatchOperation, |
| 801 | - ItemKey: "key2", |
| 802 | - ItemValue: "val2", |
| 803 | - }, |
| 804 | - }, |
| 805 | - } |
| 806 | - |
| 807 | - record(t, fixtureBase + "upsert_dictionary_items", func(c *Client) { |
| 808 | - |
| 809 | - err = c.BatchModifyDictionaryItems(batchUpsertOperations) |
| 810 | - }) |
| 811 | - if err != nil { |
| 812 | - t.Fatal(err) |
| 813 | - } |
| 814 | - |
| 815 | - |
| 816 | - // Then: I expect to be able to list all of the dictionary items with the modification present. |
| 817 | - var actualDictionaryItems []*DictionaryItem |
| 818 | - record(t, fixtureBase + "list_after_upsert", func(c *Client) { |
| 819 | - actualDictionaryItems, err = c.ListDictionaryItems(&ListDictionaryItemsInput{ |
| 820 | - Service: testService.ID, |
| 821 | - Dictionary: testDictionary.ID, |
| 822 | - }) |
| 823 | - }) |
| 824 | - if err != nil { |
| 825 | - t.Fatal(err) |
| 826 | - } |
| 827 | - |
| 828 | - actualNumberOfDictItems := len(actualDictionaryItems) |
| 829 | - expectedNumberOfDictItems := len(batchUpsertOperations.Items) |
| 830 | - if actualNumberOfDictItems != expectedNumberOfDictItems { |
| 831 | - t.Errorf("Incorrect number of dictionary items returned, expected: %d, got %d", expectedNumberOfDictItems, actualNumberOfDictItems) |
| 832 | - } |
| 833 | - |
| 834 | - for i, item := range actualDictionaryItems { |
| 835 | - |
| 836 | - actualItemKey := item.ItemKey |
| 837 | - expectedItemKey := batchUpsertOperations.Items[i].ItemKey |
| 838 | - if actualItemKey != expectedItemKey { |
| 839 | - t.Errorf("First ItemKey did not match, expected %s, got %s", expectedItemKey, actualItemKey) |
| 840 | - } |
| 841 | - |
| 842 | - actualItemValue := item.ItemValue |
| 843 | - expectedItemValue := batchUpsertOperations.Items[i].ItemValue |
| 844 | - if actualItemValue != expectedItemValue { |
| 845 | - t.Errorf("First ItemValue did not match, expected %s, got %s", expectedItemValue, actualItemValue) |
| 846 | - } |
| 847 | - |
| 848 | - } |
| 849 | - |
| 850 | -} |
| 851 | \ No newline at end of file |
| 852 | +} |
| 853 | Index: golang-github-sethvargo-go-fastly/fastly/papertrail_test.go |
| 854 | =================================================================== |
| 855 | --- golang-github-sethvargo-go-fastly.orig/fastly/papertrail_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 856 | +++ golang-github-sethvargo-go-fastly/fastly/papertrail_test.go 2019-08-22 12:51:13.515054559 +0000 |
| 857 | @@ -3,142 +3,6 @@ |
| 858 | import "testing" |
| 859 | |
| 860 | func TestClient_Papertrails(t *testing.T) { |
| 861 | - t.Parallel() |
| 862 | - |
| 863 | - var err error |
| 864 | - var tv *Version |
| 865 | - record(t, "papertrails/version", func(c *Client) { |
| 866 | - tv = testVersion(t, c) |
| 867 | - }) |
| 868 | - |
| 869 | - // Create |
| 870 | - var p *Papertrail |
| 871 | - record(t, "papertrails/create", func(c *Client) { |
| 872 | - p, err = c.CreatePapertrail(&CreatePapertrailInput{ |
| 873 | - Service: testServiceID, |
| 874 | - Version: tv.Number, |
| 875 | - Name: "test-papertrail", |
| 876 | - Address: "integ-test.go-fastly.com", |
| 877 | - Port: 1234, |
| 878 | - FormatVersion: 2, |
| 879 | - Format: "format", |
| 880 | - Placement: "waf_debug", |
| 881 | - }) |
| 882 | - }) |
| 883 | - if err != nil { |
| 884 | - t.Fatal(err) |
| 885 | - } |
| 886 | - |
| 887 | - // Ensure deleted |
| 888 | - defer func() { |
| 889 | - record(t, "papertrails/cleanup", func(c *Client) { |
| 890 | - c.DeletePapertrail(&DeletePapertrailInput{ |
| 891 | - Service: testServiceID, |
| 892 | - Version: tv.Number, |
| 893 | - Name: "test-papertrail", |
| 894 | - }) |
| 895 | - |
| 896 | - c.DeletePapertrail(&DeletePapertrailInput{ |
| 897 | - Service: testServiceID, |
| 898 | - Version: tv.Number, |
| 899 | - Name: "new-test-papertrail", |
| 900 | - }) |
| 901 | - }) |
| 902 | - }() |
| 903 | - |
| 904 | - if p.Name != "test-papertrail" { |
| 905 | - t.Errorf("bad name: %q", p.Name) |
| 906 | - } |
| 907 | - if p.Address != "integ-test.go-fastly.com" { |
| 908 | - t.Errorf("bad address: %q", p.Address) |
| 909 | - } |
| 910 | - if p.Port != 1234 { |
| 911 | - t.Errorf("bad port: %q", p.Port) |
| 912 | - } |
| 913 | - if p.FormatVersion != 2 { |
| 914 | - t.Errorf("bad format_version: %q", p.FormatVersion) |
| 915 | - } |
| 916 | - if p.Format != "format" { |
| 917 | - t.Errorf("bad format: %q", p.Format) |
| 918 | - } |
| 919 | - if p.Placement != "waf_debug" { |
| 920 | - t.Errorf("bad placement: %q", p.Placement) |
| 921 | - } |
| 922 | - |
| 923 | - // List |
| 924 | - var ps []*Papertrail |
| 925 | - record(t, "papertrails/list", func(c *Client) { |
| 926 | - ps, err = c.ListPapertrails(&ListPapertrailsInput{ |
| 927 | - Service: testServiceID, |
| 928 | - Version: tv.Number, |
| 929 | - }) |
| 930 | - }) |
| 931 | - if err != nil { |
| 932 | - t.Fatal(err) |
| 933 | - } |
| 934 | - if len(ps) < 1 { |
| 935 | - t.Errorf("bad papertrails: %v", ps) |
| 936 | - } |
| 937 | - |
| 938 | - // Get |
| 939 | - var np *Papertrail |
| 940 | - record(t, "papertrails/get", func(c *Client) { |
| 941 | - np, err = c.GetPapertrail(&GetPapertrailInput{ |
| 942 | - Service: testServiceID, |
| 943 | - Version: tv.Number, |
| 944 | - Name: "test-papertrail", |
| 945 | - }) |
| 946 | - }) |
| 947 | - if err != nil { |
| 948 | - t.Fatal(err) |
| 949 | - } |
| 950 | - if p.Name != np.Name { |
| 951 | - t.Errorf("bad name: %q", p.Name) |
| 952 | - } |
| 953 | - if p.Address != np.Address { |
| 954 | - t.Errorf("bad address: %q", p.Address) |
| 955 | - } |
| 956 | - if p.Port != np.Port { |
| 957 | - t.Errorf("bad port: %q", p.Port) |
| 958 | - } |
| 959 | - if p.FormatVersion != np.FormatVersion { |
| 960 | - t.Errorf("bad format_version: %q", p.FormatVersion) |
| 961 | - } |
| 962 | - if p.Format != np.Format { |
| 963 | - t.Errorf("bad format: %q", p.Format) |
| 964 | - } |
| 965 | - if p.Placement != np.Placement { |
| 966 | - t.Errorf("bad placement: %q", p.Placement) |
| 967 | - } |
| 968 | - |
| 969 | - // Update |
| 970 | - var up *Papertrail |
| 971 | - record(t, "papertrails/update", func(c *Client) { |
| 972 | - up, err = c.UpdatePapertrail(&UpdatePapertrailInput{ |
| 973 | - Service: testServiceID, |
| 974 | - Version: tv.Number, |
| 975 | - Name: "test-papertrail", |
| 976 | - NewName: "new-test-papertrail", |
| 977 | - }) |
| 978 | - }) |
| 979 | - if err != nil { |
| 980 | - t.Fatal(err) |
| 981 | - } |
| 982 | - if up.Name != "new-test-papertrail" { |
| 983 | - t.Errorf("bad name: %q", up.Name) |
| 984 | - } |
| 985 | - |
| 986 | - // Delete |
| 987 | - record(t, "papertrails/delete", func(c *Client) { |
| 988 | - err = c.DeletePapertrail(&DeletePapertrailInput{ |
| 989 | - Service: testServiceID, |
| 990 | - Version: tv.Number, |
| 991 | - Name: "new-test-papertrail", |
| 992 | - }) |
| 993 | - }) |
| 994 | - if err != nil { |
| 995 | - t.Fatal(err) |
| 996 | - } |
| 997 | } |
| 998 | |
| 999 | func TestClient_ListPapertrails_validation(t *testing.T) { |
| 1000 | Index: golang-github-sethvargo-go-fastly/fastly/version_test.go |
| 1001 | =================================================================== |
| 1002 | --- golang-github-sethvargo-go-fastly.orig/fastly/version_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 1003 | +++ golang-github-sethvargo-go-fastly/fastly/version_test.go 2019-08-22 12:52:34.346648850 +0000 |
| 1004 | @@ -6,114 +6,6 @@ |
| 1005 | ) |
| 1006 | |
| 1007 | func TestClient_Versions(t *testing.T) { |
| 1008 | - t.Parallel() |
| 1009 | - |
| 1010 | - var err error |
| 1011 | - |
| 1012 | - // Lock because we are creating a new version. |
| 1013 | - testVersionLock.Lock() |
| 1014 | - |
| 1015 | - // Create |
| 1016 | - var v *Version |
| 1017 | - record(t, "versions/create", func(c *Client) { |
| 1018 | - v, err = c.CreateVersion(&CreateVersionInput{ |
| 1019 | - Service: testServiceID, |
| 1020 | - Comment: "test comment", |
| 1021 | - }) |
| 1022 | - }) |
| 1023 | - if err != nil { |
| 1024 | - t.Fatal(err) |
| 1025 | - } |
| 1026 | - if v.Number == 0 { |
| 1027 | - t.Errorf("bad number: %q", v.Number) |
| 1028 | - } |
| 1029 | - if v.Comment != "test comment" { |
| 1030 | - t.Errorf("bad comment: %q", v.Comment) |
| 1031 | - } |
| 1032 | - |
| 1033 | - // Unlock and let other parallel tests go! |
| 1034 | - testVersionLock.Unlock() |
| 1035 | - |
| 1036 | - // List |
| 1037 | - var vs []*Version |
| 1038 | - record(t, "versions/list", func(c *Client) { |
| 1039 | - vs, err = c.ListVersions(&ListVersionsInput{ |
| 1040 | - Service: testServiceID, |
| 1041 | - }) |
| 1042 | - }) |
| 1043 | - if err != nil { |
| 1044 | - t.Fatal(err) |
| 1045 | - } |
| 1046 | - if len(vs) < 1 { |
| 1047 | - t.Errorf("bad services: %v", vs) |
| 1048 | - } |
| 1049 | - |
| 1050 | - // Get |
| 1051 | - var nv *Version |
| 1052 | - record(t, "versions/get", func(c *Client) { |
| 1053 | - nv, err = c.GetVersion(&GetVersionInput{ |
| 1054 | - Service: testServiceID, |
| 1055 | - Version: v.Number, |
| 1056 | - }) |
| 1057 | - }) |
| 1058 | - if err != nil { |
| 1059 | - t.Fatal(err) |
| 1060 | - } |
| 1061 | - if nv.Number == 0 { |
| 1062 | - t.Errorf("bad number: %q", nv.Number) |
| 1063 | - } |
| 1064 | - if nv.Comment != v.Comment { |
| 1065 | - t.Errorf("bad comment: %q", v.Comment) |
| 1066 | - } |
| 1067 | - |
| 1068 | - // Update |
| 1069 | - var uv *Version |
| 1070 | - record(t, "versions/update", func(c *Client) { |
| 1071 | - uv, err = c.UpdateVersion(&UpdateVersionInput{ |
| 1072 | - Service: testServiceID, |
| 1073 | - Version: v.Number, |
| 1074 | - Comment: "new comment", |
| 1075 | - }) |
| 1076 | - }) |
| 1077 | - if err != nil { |
| 1078 | - t.Fatal(err) |
| 1079 | - } |
| 1080 | - if uv.Comment != "new comment" { |
| 1081 | - t.Errorf("bad comment: %q", uv.Comment) |
| 1082 | - } |
| 1083 | - |
| 1084 | - // Lock |
| 1085 | - var vl *Version |
| 1086 | - record(t, "versions/lock", func(c *Client) { |
| 1087 | - vl, err = c.LockVersion(&LockVersionInput{ |
| 1088 | - Service: testServiceID, |
| 1089 | - Version: v.Number, |
| 1090 | - }) |
| 1091 | - }) |
| 1092 | - if err != nil { |
| 1093 | - t.Fatal(err) |
| 1094 | - } |
| 1095 | - if vl.Locked != true { |
| 1096 | - t.Errorf("bad lock: %t", vl.Locked) |
| 1097 | - } |
| 1098 | - |
| 1099 | - // Clone |
| 1100 | - var cv *Version |
| 1101 | - record(t, "versions/clone", func(c *Client) { |
| 1102 | - cv, err = c.CloneVersion(&CloneVersionInput{ |
| 1103 | - Service: testServiceID, |
| 1104 | - Version: v.Number, |
| 1105 | - }) |
| 1106 | - }) |
| 1107 | - if err != nil { |
| 1108 | - t.Fatal(err) |
| 1109 | - } |
| 1110 | - if cv.Active != false { |
| 1111 | - t.Errorf("bad clone: %t", cv.Active) |
| 1112 | - } |
| 1113 | - if cv.Comment != uv.Comment { |
| 1114 | - t.Errorf("bad comment: %q", uv.Comment) |
| 1115 | - } |
| 1116 | } |
| 1117 | |
| 1118 | func TestClient_SortVersions(t *testing.T) { |
| 1119 | Index: golang-github-sethvargo-go-fastly/fastly/waf_test.go |
| 1120 | =================================================================== |
| 1121 | --- golang-github-sethvargo-go-fastly.orig/fastly/waf_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 1122 | +++ golang-github-sethvargo-go-fastly/fastly/waf_test.go 2019-08-22 12:51:57.124993747 +0000 |
| 1123 | @@ -7,204 +7,6 @@ |
| 1124 | ) |
| 1125 | |
| 1126 | func TestClient_WAFs(t *testing.T) { |
| 1127 | - t.Parallel() |
| 1128 | - |
| 1129 | - var err error |
| 1130 | - var tv *Version |
| 1131 | - record(t, "wafs/version", func(c *Client) { |
| 1132 | - tv = testVersion(t, c) |
| 1133 | - }) |
| 1134 | - |
| 1135 | - // Enable logging on the service - we cannot create wafs without logging |
| 1136 | - // enabled |
| 1137 | - record(t, "wafs/logging/create", func(c *Client) { |
| 1138 | - _, err = c.CreateSyslog(&CreateSyslogInput{ |
| 1139 | - Service: testServiceID, |
| 1140 | - Version: tv.Number, |
| 1141 | - Name: "test-syslog", |
| 1142 | - Address: "example.com", |
| 1143 | - Hostname: "example.com", |
| 1144 | - Port: 1234, |
| 1145 | - Token: "abcd1234", |
| 1146 | - Format: "format", |
| 1147 | - FormatVersion: 2, |
| 1148 | - MessageType: "classic", |
| 1149 | - }) |
| 1150 | - }) |
| 1151 | - if err != nil { |
| 1152 | - t.Fatal(err) |
| 1153 | - } |
| 1154 | - defer func() { |
| 1155 | - record(t, "wafs/logging/cleanup", func(c *Client) { |
| 1156 | - c.DeleteSyslog(&DeleteSyslogInput{ |
| 1157 | - Service: testServiceID, |
| 1158 | - Version: tv.Number, |
| 1159 | - Name: "test-syslog", |
| 1160 | - }) |
| 1161 | - }) |
| 1162 | - }() |
| 1163 | - |
| 1164 | - // Create a condition - we cannot create a waf without attaching a condition |
| 1165 | - var condition *Condition |
| 1166 | - record(t, "wafs/condition/create", func(c *Client) { |
| 1167 | - condition, err = c.CreateCondition(&CreateConditionInput{ |
| 1168 | - Service: testServiceID, |
| 1169 | - Version: tv.Number, |
| 1170 | - Name: "test-waf-condition", |
| 1171 | - Statement: "req.url~+\"index.html\"", |
| 1172 | - Type: "PREFETCH", // This must be a prefetch condition |
| 1173 | - Priority: 1, |
| 1174 | - }) |
| 1175 | - }) |
| 1176 | - if err != nil { |
| 1177 | - t.Fatal(err) |
| 1178 | - } |
| 1179 | - defer func() { |
| 1180 | - record(t, "wafs/condition/cleanup", func(c *Client) { |
| 1181 | - c.DeleteCondition(&DeleteConditionInput{ |
| 1182 | - Service: testServiceID, |
| 1183 | - Version: tv.Number, |
| 1184 | - Name: "test-waf-condition", |
| 1185 | - }) |
| 1186 | - }) |
| 1187 | - }() |
| 1188 | - |
| 1189 | - // Create a response object |
| 1190 | - var ro *ResponseObject |
| 1191 | - record(t, "wafs/response_object/create", func(c *Client) { |
| 1192 | - ro, err = c.CreateResponseObject(&CreateResponseObjectInput{ |
| 1193 | - Service: testServiceID, |
| 1194 | - Version: tv.Number, |
| 1195 | - Name: "test-response-object", |
| 1196 | - Status: 200, |
| 1197 | - Response: "Ok", |
| 1198 | - Content: "abcd", |
| 1199 | - ContentType: "text/plain", |
| 1200 | - }) |
| 1201 | - }) |
| 1202 | - if err != nil { |
| 1203 | - t.Fatal(err) |
| 1204 | - } |
| 1205 | - defer func() { |
| 1206 | - record(t, "wafs/response_object/cleanup", func(c *Client) { |
| 1207 | - c.DeleteResponseObject(&DeleteResponseObjectInput{ |
| 1208 | - Service: testServiceID, |
| 1209 | - Version: tv.Number, |
| 1210 | - Name: ro.Name, |
| 1211 | - }) |
| 1212 | - }) |
| 1213 | - }() |
| 1214 | - |
| 1215 | - // Create |
| 1216 | - var waf *WAF |
| 1217 | - record(t, "wafs/create", func(c *Client) { |
| 1218 | - waf, err = c.CreateWAF(&CreateWAFInput{ |
| 1219 | - Service: testServiceID, |
| 1220 | - Version: tv.Number, |
| 1221 | - PrefetchCondition: condition.Name, |
| 1222 | - Response: ro.Name, |
| 1223 | - }) |
| 1224 | - }) |
| 1225 | - if err != nil { |
| 1226 | - t.Fatal(err) |
| 1227 | - } |
| 1228 | - |
| 1229 | - // List |
| 1230 | - var wafs []*WAF |
| 1231 | - record(t, "wafs/list", func(c *Client) { |
| 1232 | - wafs, err = c.ListWAFs(&ListWAFsInput{ |
| 1233 | - Service: testServiceID, |
| 1234 | - Version: tv.Number, |
| 1235 | - }) |
| 1236 | - }) |
| 1237 | - if err != nil { |
| 1238 | - t.Fatal(err) |
| 1239 | - } |
| 1240 | - if len(wafs) < 1 { |
| 1241 | - t.Errorf("bad wafs: %v", wafs) |
| 1242 | - } |
| 1243 | - |
| 1244 | - // Ensure deleted |
| 1245 | - defer func() { |
| 1246 | - record(t, "wafs/cleanup", func(c *Client) { |
| 1247 | - c.DeleteWAF(&DeleteWAFInput{ |
| 1248 | - Service: testServiceID, |
| 1249 | - Version: tv.Number, |
| 1250 | - ID: waf.ID, |
| 1251 | - }) |
| 1252 | - }) |
| 1253 | - }() |
| 1254 | - |
| 1255 | - // Get |
| 1256 | - var nwaf *WAF |
| 1257 | - record(t, "wafs/get", func(c *Client) { |
| 1258 | - nwaf, err = c.GetWAF(&GetWAFInput{ |
| 1259 | - Service: testServiceID, |
| 1260 | - Version: tv.Number, |
| 1261 | - ID: waf.ID, |
| 1262 | - }) |
| 1263 | - }) |
| 1264 | - if err != nil { |
| 1265 | - t.Fatal(err) |
| 1266 | - } |
| 1267 | - if nwaf.ID != waf.ID { |
| 1268 | - t.Errorf("expected %q to be %q", nwaf.ID, waf.ID) |
| 1269 | - } |
| 1270 | - |
| 1271 | - // Update |
| 1272 | - // Create a new response object to attach |
| 1273 | - var nro *ResponseObject |
| 1274 | - record(t, "wafs/response_object/create_another", func(c *Client) { |
| 1275 | - nro, err = c.CreateResponseObject(&CreateResponseObjectInput{ |
| 1276 | - Service: testServiceID, |
| 1277 | - Version: tv.Number, |
| 1278 | - Name: "test-response-object-2", |
| 1279 | - Status: 200, |
| 1280 | - Response: "Ok", |
| 1281 | - Content: "efgh", |
| 1282 | - ContentType: "text/plain", |
| 1283 | - }) |
| 1284 | - }) |
| 1285 | - if err != nil { |
| 1286 | - t.Fatal(err) |
| 1287 | - } |
| 1288 | - defer func() { |
| 1289 | - record(t, "wafs/response_object/cleanup_another", func(c *Client) { |
| 1290 | - c.DeleteResponseObject(&DeleteResponseObjectInput{ |
| 1291 | - Service: testServiceID, |
| 1292 | - Version: tv.Number, |
| 1293 | - Name: nro.Name, |
| 1294 | - }) |
| 1295 | - }) |
| 1296 | - }() |
| 1297 | - var uwaf *WAF |
| 1298 | - record(t, "wafs/update", func(c *Client) { |
| 1299 | - uwaf, err = c.UpdateWAF(&UpdateWAFInput{ |
| 1300 | - Service: testServiceID, |
| 1301 | - Version: tv.Number, |
| 1302 | - ID: waf.ID, |
| 1303 | - Response: nro.Name, |
| 1304 | - }) |
| 1305 | - }) |
| 1306 | - if err != nil { |
| 1307 | - t.Fatal(err) |
| 1308 | - } |
| 1309 | - if uwaf.Response != "test-response-object-2" { |
| 1310 | - t.Errorf("bad name: %q", uwaf.Response) |
| 1311 | - } |
| 1312 | - |
| 1313 | - // Delete |
| 1314 | - record(t, "wafs/delete", func(c *Client) { |
| 1315 | - err = c.DeleteWAF(&DeleteWAFInput{ |
| 1316 | - Service: testServiceID, |
| 1317 | - Version: tv.Number, |
| 1318 | - ID: waf.ID, |
| 1319 | - }) |
| 1320 | - }) |
| 1321 | - if err != nil { |
| 1322 | - t.Fatal(err) |
| 1323 | - } |
| 1324 | - |
| 1325 | } |
| 1326 | |
| 1327 | func TestClient_ListWAFs_validation(t *testing.T) { |
| 1328 | Index: golang-github-sethvargo-go-fastly/fastly/acl_entry_test.go |
| 1329 | =================================================================== |
| 1330 | --- golang-github-sethvargo-go-fastly.orig/fastly/acl_entry_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 1331 | +++ golang-github-sethvargo-go-fastly/fastly/acl_entry_test.go 2019-08-22 13:03:55.416933587 +0000 |
| 1332 | @@ -3,135 +3,6 @@ |
| 1333 | import "testing" |
| 1334 | |
| 1335 | func TestClient_ACLEntries(t *testing.T) { |
| 1336 | - |
| 1337 | - fixtureBase := "acl_entries/" |
| 1338 | - nameSuffix := "ACLEntries" |
| 1339 | - |
| 1340 | - testService := createTestService(t, fixtureBase+"create_service", nameSuffix) |
| 1341 | - defer deleteTestService(t, fixtureBase+"delete_service", testService.ID) |
| 1342 | - |
| 1343 | - testVersion := createTestVersion(t, fixtureBase+"version", testService.ID) |
| 1344 | - |
| 1345 | - testACL := createTestACL(t, fixtureBase+"acl", testService.ID, testVersion.Number, nameSuffix) |
| 1346 | - defer deleteTestACL(t, testACL, fixtureBase+"delete_acl") |
| 1347 | - |
| 1348 | - // Create |
| 1349 | - var err error |
| 1350 | - var e *ACLEntry |
| 1351 | - record(t, fixtureBase+"create", func(c *Client) { |
| 1352 | - e, err = c.CreateACLEntry(&CreateACLEntryInput{ |
| 1353 | - Service: testService.ID, |
| 1354 | - ACL: testACL.ID, |
| 1355 | - IP: "10.0.0.3", |
| 1356 | - Subnet: "8", |
| 1357 | - Negated: false, |
| 1358 | - Comment: "test entry", |
| 1359 | - }) |
| 1360 | - }) |
| 1361 | - if err != nil { |
| 1362 | - t.Fatal(err) |
| 1363 | - } |
| 1364 | - |
| 1365 | - if e.IP != "10.0.0.3" { |
| 1366 | - t.Errorf("bad IP: %q", e.IP) |
| 1367 | - } |
| 1368 | - |
| 1369 | - if e.Subnet != "8" { |
| 1370 | - t.Errorf("Bad subnet: %q", e.Subnet) |
| 1371 | - } |
| 1372 | - |
| 1373 | - if e.Negated != false { |
| 1374 | - t.Errorf("Bad negated flag: %t", e.Negated) |
| 1375 | - } |
| 1376 | - |
| 1377 | - if e.Comment != "test entry" { |
| 1378 | - t.Errorf("Bad comment: %q", e.Comment) |
| 1379 | - } |
| 1380 | - |
| 1381 | - // List |
| 1382 | - var es []*ACLEntry |
| 1383 | - record(t, fixtureBase+"list", func(c *Client) { |
| 1384 | - es, err = c.ListACLEntries(&ListACLEntriesInput{ |
| 1385 | - Service: testService.ID, |
| 1386 | - ACL: testACL.ID, |
| 1387 | - }) |
| 1388 | - }) |
| 1389 | - if err != nil { |
| 1390 | - t.Fatal(err) |
| 1391 | - } |
| 1392 | - |
| 1393 | - if len(es) != 1 { |
| 1394 | - t.Errorf("Bad entries: %v", es) |
| 1395 | - } |
| 1396 | - |
| 1397 | - // Get |
| 1398 | - var ne *ACLEntry |
| 1399 | - record(t, fixtureBase+"get", func(c *Client) { |
| 1400 | - ne, err = c.GetACLEntry(&GetACLEntryInput{ |
| 1401 | - Service: testService.ID, |
| 1402 | - ACL: testACL.ID, |
| 1403 | - ID: e.ID, |
| 1404 | - }) |
| 1405 | - }) |
| 1406 | - |
| 1407 | - if e.IP != ne.IP { |
| 1408 | - t.Errorf("bad IP: %v", ne.IP) |
| 1409 | - } |
| 1410 | - |
| 1411 | - if e.Subnet != ne.Subnet { |
| 1412 | - t.Errorf("bad subnet: %v", ne.Subnet) |
| 1413 | - } |
| 1414 | - |
| 1415 | - if e.Negated != ne.Negated { |
| 1416 | - t.Errorf("bad Negated flag: %v", ne.Negated) |
| 1417 | - } |
| 1418 | - |
| 1419 | - if e.Comment != ne.Comment { |
| 1420 | - t.Errorf("bad comment: %v", ne.Comment) |
| 1421 | - } |
| 1422 | - |
| 1423 | - // Update |
| 1424 | - var ue *ACLEntry |
| 1425 | - record(t, fixtureBase+"update", func(c *Client) { |
| 1426 | - ue, err = c.UpdateACLEntry(&UpdateACLEntryInput{ |
| 1427 | - Service: testService.ID, |
| 1428 | - ACL: testACL.ID, |
| 1429 | - ID: e.ID, |
| 1430 | - IP: "10.0.0.4", |
| 1431 | - Negated: true, |
| 1432 | - }) |
| 1433 | - }) |
| 1434 | - if err != nil { |
| 1435 | - t.Fatal(err) |
| 1436 | - } |
| 1437 | - |
| 1438 | - if ue.IP != "10.0.0.4" { |
| 1439 | - t.Errorf("bad IP: %q", ue.IP) |
| 1440 | - } |
| 1441 | - if e.Subnet != ue.Subnet { |
| 1442 | - t.Errorf("bad subnet: %v", ne.Subnet) |
| 1443 | - } |
| 1444 | - |
| 1445 | - if ue.Negated != true { |
| 1446 | - t.Errorf("bad Negated flag: %v", ne.Negated) |
| 1447 | - } |
| 1448 | - |
| 1449 | - if e.Comment != ue.Comment { |
| 1450 | - t.Errorf("bad comment: %v", ne.Comment) |
| 1451 | - } |
| 1452 | - |
| 1453 | - // Delete |
| 1454 | - record(t, fixtureBase+"delete", func(c *Client) { |
| 1455 | - err = c.DeleteACLEntry(&DeleteACLEntryInput{ |
| 1456 | - Service: testService.ID, |
| 1457 | - ACL: testACL.ID, |
| 1458 | - ID: e.ID, |
| 1459 | - }) |
| 1460 | - }) |
| 1461 | - if err != nil { |
| 1462 | - t.Fatal(err) |
| 1463 | - } |
| 1464 | - |
| 1465 | } |
| 1466 | |
| 1467 | func TestClient_ListACLEntries_validation(t *testing.T) { |
| 1468 | Index: golang-github-sethvargo-go-fastly/fastly/backend_test.go |
| 1469 | =================================================================== |
| 1470 | --- golang-github-sethvargo-go-fastly.orig/fastly/backend_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 1471 | +++ golang-github-sethvargo-go-fastly/fastly/backend_test.go 2019-08-22 13:05:21.388756445 +0000 |
| 1472 | @@ -3,139 +3,6 @@ |
| 1473 | import "testing" |
| 1474 | |
| 1475 | func TestClient_Backends(t *testing.T) { |
| 1476 | - t.Parallel() |
| 1477 | - |
| 1478 | - var err error |
| 1479 | - var tv *Version |
| 1480 | - record(t, "backends/version", func(c *Client) { |
| 1481 | - tv = testVersion(t, c) |
| 1482 | - }) |
| 1483 | - |
| 1484 | - // Create |
| 1485 | - var b *Backend |
| 1486 | - record(t, "backends/create", func(c *Client) { |
| 1487 | - b, err = c.CreateBackend(&CreateBackendInput{ |
| 1488 | - Service: testServiceID, |
| 1489 | - Version: tv.Number, |
| 1490 | - Name: "test-backend", |
| 1491 | - Address: "integ-test.go-fastly.com", |
| 1492 | - Port: 1234, |
| 1493 | - ConnectTimeout: 1500, |
| 1494 | - OverrideHost: "origin.example.com", |
| 1495 | - }) |
| 1496 | - }) |
| 1497 | - if err != nil { |
| 1498 | - t.Fatal(err) |
| 1499 | - } |
| 1500 | - |
| 1501 | - // Ensure deleted |
| 1502 | - defer func() { |
| 1503 | - record(t, "backends/cleanup", func(c *Client) { |
| 1504 | - c.DeleteBackend(&DeleteBackendInput{ |
| 1505 | - Service: testServiceID, |
| 1506 | - Version: tv.Number, |
| 1507 | - Name: "test-backend", |
| 1508 | - }) |
| 1509 | - |
| 1510 | - c.DeleteBackend(&DeleteBackendInput{ |
| 1511 | - Service: testServiceID, |
| 1512 | - Version: tv.Number, |
| 1513 | - Name: "new-test-backend", |
| 1514 | - }) |
| 1515 | - }) |
| 1516 | - }() |
| 1517 | - |
| 1518 | - if b.Name != "test-backend" { |
| 1519 | - t.Errorf("bad name: %q", b.Name) |
| 1520 | - } |
| 1521 | - if b.Address != "integ-test.go-fastly.com" { |
| 1522 | - t.Errorf("bad address: %q", b.Address) |
| 1523 | - } |
| 1524 | - if b.Port != 1234 { |
| 1525 | - t.Errorf("bad port: %d", b.Port) |
| 1526 | - } |
| 1527 | - if b.ConnectTimeout != 1500 { |
| 1528 | - t.Errorf("bad connect_timeout: %d", b.ConnectTimeout) |
| 1529 | - } |
| 1530 | - if b.OverrideHost != "origin.example.com" { |
| 1531 | - t.Errorf("bad override_host: %q", b.OverrideHost) |
| 1532 | - } |
| 1533 | - |
| 1534 | - // List |
| 1535 | - var bs []*Backend |
| 1536 | - record(t, "backends/list", func(c *Client) { |
| 1537 | - bs, err = c.ListBackends(&ListBackendsInput{ |
| 1538 | - Service: testServiceID, |
| 1539 | - Version: tv.Number, |
| 1540 | - }) |
| 1541 | - }) |
| 1542 | - if err != nil { |
| 1543 | - t.Fatal(err) |
| 1544 | - } |
| 1545 | - if len(bs) < 1 { |
| 1546 | - t.Errorf("bad backends: %v", bs) |
| 1547 | - } |
| 1548 | - |
| 1549 | - // Get |
| 1550 | - var nb *Backend |
| 1551 | - record(t, "backends/get", func(c *Client) { |
| 1552 | - nb, err = c.GetBackend(&GetBackendInput{ |
| 1553 | - Service: testServiceID, |
| 1554 | - Version: tv.Number, |
| 1555 | - Name: "test-backend", |
| 1556 | - }) |
| 1557 | - }) |
| 1558 | - if err != nil { |
| 1559 | - t.Fatal(err) |
| 1560 | - } |
| 1561 | - if b.Name != nb.Name { |
| 1562 | - t.Errorf("bad name: %q (%q)", b.Name, nb.Name) |
| 1563 | - } |
| 1564 | - if b.Address != nb.Address { |
| 1565 | - t.Errorf("bad address: %q (%q)", b.Address, nb.Address) |
| 1566 | - } |
| 1567 | - if b.Port != nb.Port { |
| 1568 | - t.Errorf("bad port: %q (%q)", b.Port, nb.Port) |
| 1569 | - } |
| 1570 | - if b.ConnectTimeout != nb.ConnectTimeout { |
| 1571 | - t.Errorf("bad connect_timeout: %q (%q)", b.ConnectTimeout, nb.ConnectTimeout) |
| 1572 | - } |
| 1573 | - if b.OverrideHost != nb.OverrideHost { |
| 1574 | - t.Errorf("bad override_host: %q (%q)", b.OverrideHost, nb.OverrideHost) |
| 1575 | - } |
| 1576 | - |
| 1577 | - // Update |
| 1578 | - var ub *Backend |
| 1579 | - record(t, "backends/update", func(c *Client) { |
| 1580 | - ub, err = c.UpdateBackend(&UpdateBackendInput{ |
| 1581 | - Service: testServiceID, |
| 1582 | - Version: tv.Number, |
| 1583 | - Name: "test-backend", |
| 1584 | - NewName: "new-test-backend", |
| 1585 | - OverrideHost: "www.example.com", |
| 1586 | - }) |
| 1587 | - }) |
| 1588 | - if err != nil { |
| 1589 | - t.Fatal(err) |
| 1590 | - } |
| 1591 | - if ub.Name != "new-test-backend" { |
| 1592 | - t.Errorf("bad name: %q", ub.Name) |
| 1593 | - } |
| 1594 | - if ub.OverrideHost != "www.example.com" { |
| 1595 | - t.Errorf("bad override_host: %q", ub.OverrideHost) |
| 1596 | - } |
| 1597 | - |
| 1598 | - // Delete |
| 1599 | - record(t, "backends/delete", func(c *Client) { |
| 1600 | - err = c.DeleteBackend(&DeleteBackendInput{ |
| 1601 | - Service: testServiceID, |
| 1602 | - Version: tv.Number, |
| 1603 | - Name: "new-test-backend", |
| 1604 | - }) |
| 1605 | - }) |
| 1606 | - if err != nil { |
| 1607 | - t.Fatal(err) |
| 1608 | - } |
| 1609 | } |
| 1610 | |
| 1611 | func TestClient_ListBackends_validation(t *testing.T) { |
| 1612 | Index: golang-github-sethvargo-go-fastly/fastly/dictionary_item_test.go |
| 1613 | =================================================================== |
| 1614 | --- golang-github-sethvargo-go-fastly.orig/fastly/dictionary_item_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 1615 | +++ golang-github-sethvargo-go-fastly/fastly/dictionary_item_test.go 2019-08-22 13:04:41.430979666 +0000 |
| 1616 | @@ -3,113 +3,6 @@ |
| 1617 | import "testing" |
| 1618 | |
| 1619 | func TestClient_DictionaryItems(t *testing.T) { |
| 1620 | - |
| 1621 | - fixtureBase := "dictionary_items/" |
| 1622 | - nameSuffix := "DictionaryItems" |
| 1623 | - |
| 1624 | - testService := createTestService(t, fixtureBase + "create_service", nameSuffix) |
| 1625 | - defer deleteTestService(t, fixtureBase +"delete_service", testService.ID) |
| 1626 | - |
| 1627 | - testVersion := createTestVersion(t, fixtureBase+"version", testService.ID) |
| 1628 | - |
| 1629 | - testDictionary := createTestDictionary(t, fixtureBase+"dictionary", testService.ID, testVersion.Number, nameSuffix) |
| 1630 | - defer deleteTestDictionary(t, testDictionary, fixtureBase+"delete_dictionary") |
| 1631 | - |
| 1632 | - // Create |
| 1633 | - var err error |
| 1634 | - var createdDictionaryItem *DictionaryItem |
| 1635 | - record(t, fixtureBase+"create", func(c *Client) { |
| 1636 | - createdDictionaryItem, err = c.CreateDictionaryItem(&CreateDictionaryItemInput{ |
| 1637 | - Service: testService.ID, |
| 1638 | - Dictionary: testDictionary.ID, |
| 1639 | - ItemKey: "test-dictionary-item", |
| 1640 | - ItemValue: "value", |
| 1641 | - }) |
| 1642 | - }) |
| 1643 | - if err != nil { |
| 1644 | - t.Fatal(err) |
| 1645 | - } |
| 1646 | - |
| 1647 | - // Ensure deleted |
| 1648 | - defer func() { |
| 1649 | - record(t, fixtureBase+"cleanup", func(c *Client) { |
| 1650 | - c.DeleteDictionaryItem(&DeleteDictionaryItemInput{ |
| 1651 | - Service: testService.ID, |
| 1652 | - Dictionary: testDictionary.ID, |
| 1653 | - ItemKey: "test-dictionary-item", |
| 1654 | - }) |
| 1655 | - }) |
| 1656 | - }() |
| 1657 | - |
| 1658 | - if createdDictionaryItem.ItemKey != "test-dictionary-item" { |
| 1659 | - t.Errorf("bad item_key: %q", createdDictionaryItem.ItemKey) |
| 1660 | - } |
| 1661 | - if createdDictionaryItem.ItemValue != "value" { |
| 1662 | - t.Errorf("bad item_value: %q", createdDictionaryItem.ItemValue) |
| 1663 | - } |
| 1664 | - |
| 1665 | - // List |
| 1666 | - var dictionaryItems []*DictionaryItem |
| 1667 | - record(t, fixtureBase+"list", func(c *Client) { |
| 1668 | - dictionaryItems, err = c.ListDictionaryItems(&ListDictionaryItemsInput{ |
| 1669 | - Service: testService.ID, |
| 1670 | - Dictionary: testDictionary.ID, |
| 1671 | - }) |
| 1672 | - }) |
| 1673 | - if err != nil { |
| 1674 | - t.Fatal(err) |
| 1675 | - } |
| 1676 | - if len(dictionaryItems) < 1 { |
| 1677 | - t.Errorf("bad dictionary items: %v", dictionaryItems) |
| 1678 | - } |
| 1679 | - |
| 1680 | - // Get |
| 1681 | - var retrievedDictionaryItem *DictionaryItem |
| 1682 | - record(t, fixtureBase+"get", func(c *Client) { |
| 1683 | - retrievedDictionaryItem, err = c.GetDictionaryItem(&GetDictionaryItemInput{ |
| 1684 | - Service: testService.ID, |
| 1685 | - Dictionary: testDictionary.ID, |
| 1686 | - ItemKey: "test-dictionary-item", |
| 1687 | - }) |
| 1688 | - }) |
| 1689 | - if err != nil { |
| 1690 | - t.Fatal(err) |
| 1691 | - } |
| 1692 | - if retrievedDictionaryItem.ItemKey != "test-dictionary-item" { |
| 1693 | - t.Errorf("bad item_key: %q", retrievedDictionaryItem.ItemKey) |
| 1694 | - } |
| 1695 | - if retrievedDictionaryItem.ItemValue != "value" { |
| 1696 | - t.Errorf("bad item_value: %q", retrievedDictionaryItem.ItemValue) |
| 1697 | - } |
| 1698 | - |
| 1699 | - // Update |
| 1700 | - var updatedDictionaryItem *DictionaryItem |
| 1701 | - record(t, fixtureBase+"update", func(c *Client) { |
| 1702 | - updatedDictionaryItem, err = c.UpdateDictionaryItem(&UpdateDictionaryItemInput{ |
| 1703 | - Service: testService.ID, |
| 1704 | - Dictionary: testDictionary.ID, |
| 1705 | - ItemKey: "test-dictionary-item", |
| 1706 | - ItemValue: "new-value", |
| 1707 | - }) |
| 1708 | - }) |
| 1709 | - if err != nil { |
| 1710 | - t.Fatal(err) |
| 1711 | - } |
| 1712 | - if updatedDictionaryItem.ItemValue != "new-value" { |
| 1713 | - t.Errorf("bad item_value: %q", updatedDictionaryItem.ItemValue) |
| 1714 | - } |
| 1715 | - |
| 1716 | - // Delete |
| 1717 | - record(t, fixtureBase+"delete", func(c *Client) { |
| 1718 | - err = c.DeleteDictionaryItem(&DeleteDictionaryItemInput{ |
| 1719 | - Service: testService.ID, |
| 1720 | - Dictionary: testDictionary.ID, |
| 1721 | - ItemKey: "test-dictionary-item", |
| 1722 | - }) |
| 1723 | - }) |
| 1724 | - if err != nil { |
| 1725 | - t.Fatal(err) |
| 1726 | - } |
| 1727 | } |
| 1728 | |
| 1729 | func TestClient_ListDictionaryItems_validation(t *testing.T) { |
| 1730 | Index: golang-github-sethvargo-go-fastly/fastly/stats_test.go |
| 1731 | =================================================================== |
| 1732 | --- golang-github-sethvargo-go-fastly.orig/fastly/stats_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 1733 | +++ golang-github-sethvargo-go-fastly/fastly/stats_test.go 2019-08-22 13:10:13.977766825 +0000 |
| 1734 | @@ -3,66 +3,13 @@ |
| 1735 | import "testing" |
| 1736 | |
| 1737 | func TestClient_GetStats(t *testing.T) { |
| 1738 | - t.Parallel() |
| 1739 | - |
| 1740 | - var err error |
| 1741 | - record(t, "stats/service_stats", func(c *Client) { |
| 1742 | - _, err = c.GetStats(&GetStatsInput{ |
| 1743 | - Service: testServiceID, |
| 1744 | - From: "10 days ago", |
| 1745 | - To: "now", |
| 1746 | - By: "minute", |
| 1747 | - Region: "europe", |
| 1748 | - }) |
| 1749 | - }) |
| 1750 | - if err != nil { |
| 1751 | - t.Fatal(err) |
| 1752 | - } |
| 1753 | - |
| 1754 | } |
| 1755 | |
| 1756 | func TestClient_GetRegions(t *testing.T) { |
| 1757 | - t.Parallel() |
| 1758 | - |
| 1759 | - var err error |
| 1760 | - record(t, "stats/regions", func(c *Client) { |
| 1761 | - _, err = c.GetRegions() |
| 1762 | - }) |
| 1763 | - if err != nil { |
| 1764 | - t.Fatal(err) |
| 1765 | - } |
| 1766 | } |
| 1767 | |
| 1768 | func TestClient_GetRegionsUsage(t *testing.T) { |
| 1769 | - t.Parallel() |
| 1770 | - |
| 1771 | - var err error |
| 1772 | - record(t, "stats/regions_usage", func(c *Client) { |
| 1773 | - _, err = c.GetUsage(&GetUsageInput{ |
| 1774 | - From: "10 days ago", |
| 1775 | - To: "now", |
| 1776 | - By: "minute", |
| 1777 | - Region: "usa", |
| 1778 | - }) |
| 1779 | - }) |
| 1780 | - if err != nil { |
| 1781 | - t.Fatal(err) |
| 1782 | - } |
| 1783 | } |
| 1784 | |
| 1785 | func TestClient_GetServicesByRegionsUsage(t *testing.T) { |
| 1786 | - t.Parallel() |
| 1787 | - |
| 1788 | - var err error |
| 1789 | - record(t, "stats/services_usage", func(c *Client) { |
| 1790 | - _, err = c.GetUsageByService(&GetUsageInput{ |
| 1791 | - From: "10 days ago", |
| 1792 | - To: "now", |
| 1793 | - By: "minute", |
| 1794 | - Region: "usa", |
| 1795 | - }) |
| 1796 | - }) |
| 1797 | - if err != nil { |
| 1798 | - t.Fatal(err) |
| 1799 | - } |
| 1800 | } |
| 1801 | Index: golang-github-sethvargo-go-fastly/fastly/sumologic_test.go |
| 1802 | =================================================================== |
| 1803 | --- golang-github-sethvargo-go-fastly.orig/fastly/sumologic_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 1804 | +++ golang-github-sethvargo-go-fastly/fastly/sumologic_test.go 2019-08-22 13:10:53.111506958 +0000 |
| 1805 | @@ -3,142 +3,6 @@ |
| 1806 | import "testing" |
| 1807 | |
| 1808 | func TestClient_Sumologics(t *testing.T) { |
| 1809 | - t.Parallel() |
| 1810 | - |
| 1811 | - var err error |
| 1812 | - var tv *Version |
| 1813 | - record(t, "sumologics/version", func(c *Client) { |
| 1814 | - tv = testVersion(t, c) |
| 1815 | - }) |
| 1816 | - |
| 1817 | - // Create |
| 1818 | - var s *Sumologic |
| 1819 | - record(t, "sumologics/create", func(c *Client) { |
| 1820 | - s, err = c.CreateSumologic(&CreateSumologicInput{ |
| 1821 | - Service: testServiceID, |
| 1822 | - Version: tv.Number, |
| 1823 | - Name: "test-sumologic", |
| 1824 | - URL: "https://foo.sumologic.com", |
| 1825 | - Format: "format", |
| 1826 | - FormatVersion: 1, |
| 1827 | - MessageType: "classic", |
| 1828 | - Placement: "waf_debug", |
| 1829 | - }) |
| 1830 | - }) |
| 1831 | - if err != nil { |
| 1832 | - t.Fatal(err) |
| 1833 | - } |
| 1834 | - |
| 1835 | - // Ensure deleted |
| 1836 | - defer func() { |
| 1837 | - record(t, "sumologics/cleanup", func(c *Client) { |
| 1838 | - c.DeleteSumologic(&DeleteSumologicInput{ |
| 1839 | - Service: testServiceID, |
| 1840 | - Version: tv.Number, |
| 1841 | - Name: "test-sumologic", |
| 1842 | - }) |
| 1843 | - |
| 1844 | - c.DeleteSumologic(&DeleteSumologicInput{ |
| 1845 | - Service: testServiceID, |
| 1846 | - Version: tv.Number, |
| 1847 | - Name: "new-test-sumologic", |
| 1848 | - }) |
| 1849 | - }) |
| 1850 | - }() |
| 1851 | - |
| 1852 | - if s.Name != "test-sumologic" { |
| 1853 | - t.Errorf("bad name: %q", s.Name) |
| 1854 | - } |
| 1855 | - if s.URL != "https://foo.sumologic.com" { |
| 1856 | - t.Errorf("bad url: %q", s.URL) |
| 1857 | - } |
| 1858 | - if s.Format != "format" { |
| 1859 | - t.Errorf("bad format: %q", s.Format) |
| 1860 | - } |
| 1861 | - if s.FormatVersion != 1 { |
| 1862 | - t.Errorf("bad format version: %q", s.FormatVersion) |
| 1863 | - } |
| 1864 | - if s.MessageType != "classic" { |
| 1865 | - t.Errorf("bad message type: %q", s.MessageType) |
| 1866 | - } |
| 1867 | - if s.Placement != "waf_debug" { |
| 1868 | - t.Errorf("bad placement: %q", s.Placement) |
| 1869 | - } |
| 1870 | - |
| 1871 | - // List |
| 1872 | - var ss []*Sumologic |
| 1873 | - record(t, "sumologics/list", func(c *Client) { |
| 1874 | - ss, err = c.ListSumologics(&ListSumologicsInput{ |
| 1875 | - Service: testServiceID, |
| 1876 | - Version: tv.Number, |
| 1877 | - }) |
| 1878 | - }) |
| 1879 | - if err != nil { |
| 1880 | - t.Fatal(err) |
| 1881 | - } |
| 1882 | - if len(ss) < 1 { |
| 1883 | - t.Errorf("bad sumologics: %v", ss) |
| 1884 | - } |
| 1885 | - |
| 1886 | - // Get |
| 1887 | - var ns *Sumologic |
| 1888 | - record(t, "sumologics/get", func(c *Client) { |
| 1889 | - ns, err = c.GetSumologic(&GetSumologicInput{ |
| 1890 | - Service: testServiceID, |
| 1891 | - Version: tv.Number, |
| 1892 | - Name: "test-sumologic", |
| 1893 | - }) |
| 1894 | - }) |
| 1895 | - if err != nil { |
| 1896 | - t.Fatal(err) |
| 1897 | - } |
| 1898 | - if s.Name != ns.Name { |
| 1899 | - t.Errorf("bad name: %q", s.Name) |
| 1900 | - } |
| 1901 | - if s.URL != ns.URL { |
| 1902 | - t.Errorf("bad url: %q", s.URL) |
| 1903 | - } |
| 1904 | - if s.Format != ns.Format { |
| 1905 | - t.Errorf("bad format: %q", s.Format) |
| 1906 | - } |
| 1907 | - if s.FormatVersion != ns.FormatVersion { |
| 1908 | - t.Errorf("bad format version: %q", s.FormatVersion) |
| 1909 | - } |
| 1910 | - if s.MessageType != ns.MessageType { |
| 1911 | - t.Errorf("bad message type: %q", s.MessageType) |
| 1912 | - } |
| 1913 | - if s.Placement != ns.Placement { |
| 1914 | - t.Errorf("bad placement: %q", s.Placement) |
| 1915 | - } |
| 1916 | - |
| 1917 | - // Update |
| 1918 | - var us *Sumologic |
| 1919 | - record(t, "sumologics/update", func(c *Client) { |
| 1920 | - us, err = c.UpdateSumologic(&UpdateSumologicInput{ |
| 1921 | - Service: testServiceID, |
| 1922 | - Version: tv.Number, |
| 1923 | - Name: "test-sumologic", |
| 1924 | - NewName: "new-test-sumologic", |
| 1925 | - }) |
| 1926 | - }) |
| 1927 | - if err != nil { |
| 1928 | - t.Fatal(err) |
| 1929 | - } |
| 1930 | - if us.Name != "new-test-sumologic" { |
| 1931 | - t.Errorf("bad name: %q", us.Name) |
| 1932 | - } |
| 1933 | - |
| 1934 | - // Delete |
| 1935 | - record(t, "sumologics/delete", func(c *Client) { |
| 1936 | - err = c.DeleteSumologic(&DeleteSumologicInput{ |
| 1937 | - Service: testServiceID, |
| 1938 | - Version: tv.Number, |
| 1939 | - Name: "new-test-sumologic", |
| 1940 | - }) |
| 1941 | - }) |
| 1942 | - if err != nil { |
| 1943 | - t.Fatal(err) |
| 1944 | - } |
| 1945 | } |
| 1946 | |
| 1947 | func TestClient_ListSumologics_validation(t *testing.T) { |
| 1948 | Index: golang-github-sethvargo-go-fastly/fastly/syslog_test.go |
| 1949 | =================================================================== |
| 1950 | --- golang-github-sethvargo-go-fastly.orig/fastly/syslog_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 1951 | +++ golang-github-sethvargo-go-fastly/fastly/syslog_test.go 2019-08-22 13:19:25.602295582 +0000 |
| 1952 | @@ -1,212 +1,10 @@ |
| 1953 | package fastly |
| 1954 | |
| 1955 | import ( |
| 1956 | - "strings" |
| 1957 | "testing" |
| 1958 | ) |
| 1959 | |
| 1960 | func TestClient_Syslogs(t *testing.T) { |
| 1961 | - t.Parallel() |
| 1962 | - |
| 1963 | - var err error |
| 1964 | - var tv *Version |
| 1965 | - record(t, "syslogs/version", func(c *Client) { |
| 1966 | - tv = testVersion(t, c) |
| 1967 | - }) |
| 1968 | - |
| 1969 | - cert := strings.TrimSpace(` |
| 1970 | ------BEGIN CERTIFICATE----- |
| 1971 | -MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL |
| 1972 | -MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC |
| 1973 | -VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx |
| 1974 | -NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD |
| 1975 | -TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu |
| 1976 | -ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j |
| 1977 | -V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj |
| 1978 | -gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA |
| 1979 | -FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE |
| 1980 | -CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS |
| 1981 | -BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE |
| 1982 | -BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju |
| 1983 | -Wm7DCfrPNGVwFWUQOmsPue9rZBgO |
| 1984 | ------END CERTIFICATE----- |
| 1985 | -`) |
| 1986 | - |
| 1987 | - // Create |
| 1988 | - var s *Syslog |
| 1989 | - record(t, "syslogs/create", func(c *Client) { |
| 1990 | - s, err = c.CreateSyslog(&CreateSyslogInput{ |
| 1991 | - Service: testServiceID, |
| 1992 | - Version: tv.Number, |
| 1993 | - Name: "test-syslog", |
| 1994 | - Address: "example.com", |
| 1995 | - Hostname: "example.com", |
| 1996 | - Port: 1234, |
| 1997 | - UseTLS: CBool(true), |
| 1998 | - TLSCACert: cert, |
| 1999 | - TLSHostname: "example.com", |
| 2000 | - Token: "abcd1234", |
| 2001 | - Format: "format", |
| 2002 | - FormatVersion: 2, |
| 2003 | - MessageType: "classic", |
| 2004 | - Placement: "waf_debug", |
| 2005 | - }) |
| 2006 | - }) |
| 2007 | - if err != nil { |
| 2008 | - t.Fatal(err) |
| 2009 | - } |
| 2010 | - |
| 2011 | - // Ensure deleted |
| 2012 | - defer func() { |
| 2013 | - record(t, "syslogs/cleanup", func(c *Client) { |
| 2014 | - c.DeleteSyslog(&DeleteSyslogInput{ |
| 2015 | - Service: testServiceID, |
| 2016 | - Version: tv.Number, |
| 2017 | - Name: "test-syslog", |
| 2018 | - }) |
| 2019 | - |
| 2020 | - c.DeleteSyslog(&DeleteSyslogInput{ |
| 2021 | - Service: testServiceID, |
| 2022 | - Version: tv.Number, |
| 2023 | - Name: "new-test-syslog", |
| 2024 | - }) |
| 2025 | - }) |
| 2026 | - }() |
| 2027 | - |
| 2028 | - if s.Name != "test-syslog" { |
| 2029 | - t.Errorf("bad name: %q", s.Name) |
| 2030 | - } |
| 2031 | - if s.Address != "example.com" { |
| 2032 | - t.Errorf("bad address: %q", s.Address) |
| 2033 | - } |
| 2034 | - if s.Hostname != "example.com" { |
| 2035 | - t.Errorf("bad hostname: %q", s.Hostname) |
| 2036 | - } |
| 2037 | - if s.Port != 1234 { |
| 2038 | - t.Errorf("bad port: %q", s.Port) |
| 2039 | - } |
| 2040 | - if s.UseTLS != true { |
| 2041 | - t.Errorf("bad use_tls: %t", s.UseTLS) |
| 2042 | - } |
| 2043 | - if s.TLSCACert != cert { |
| 2044 | - t.Errorf("bad tls_ca_cert: %q", s.TLSCACert) |
| 2045 | - } |
| 2046 | - if s.TLSHostname != "example.com" { |
| 2047 | - t.Errorf("bad tls_hostname: %q", s.TLSHostname) |
| 2048 | - } |
| 2049 | - if s.Token != "abcd1234" { |
| 2050 | - t.Errorf("bad token: %q", s.Token) |
| 2051 | - } |
| 2052 | - if s.Format != "format" { |
| 2053 | - t.Errorf("bad format: %q", s.Format) |
| 2054 | - } |
| 2055 | - if s.FormatVersion != 2 { |
| 2056 | - t.Errorf("bad format_version: %d", s.FormatVersion) |
| 2057 | - } |
| 2058 | - if s.MessageType != "classic" { |
| 2059 | - t.Errorf("bad message_type: %s", s.MessageType) |
| 2060 | - } |
| 2061 | - if s.Placement != "waf_debug" { |
| 2062 | - t.Errorf("bad placement: %q", s.Placement) |
| 2063 | - } |
| 2064 | - |
| 2065 | - // List |
| 2066 | - var ss []*Syslog |
| 2067 | - record(t, "syslogs/list", func(c *Client) { |
| 2068 | - ss, err = c.ListSyslogs(&ListSyslogsInput{ |
| 2069 | - Service: testServiceID, |
| 2070 | - Version: tv.Number, |
| 2071 | - }) |
| 2072 | - }) |
| 2073 | - if err != nil { |
| 2074 | - t.Fatal(err) |
| 2075 | - } |
| 2076 | - if len(ss) < 1 { |
| 2077 | - t.Errorf("bad syslogs: %v", ss) |
| 2078 | - } |
| 2079 | - |
| 2080 | - // Get |
| 2081 | - var ns *Syslog |
| 2082 | - record(t, "syslogs/get", func(c *Client) { |
| 2083 | - ns, err = c.GetSyslog(&GetSyslogInput{ |
| 2084 | - Service: testServiceID, |
| 2085 | - Version: tv.Number, |
| 2086 | - Name: "test-syslog", |
| 2087 | - }) |
| 2088 | - }) |
| 2089 | - if err != nil { |
| 2090 | - t.Fatal(err) |
| 2091 | - } |
| 2092 | - if s.Name != ns.Name { |
| 2093 | - t.Errorf("bad name: %q", s.Name) |
| 2094 | - } |
| 2095 | - if s.Address != ns.Address { |
| 2096 | - t.Errorf("bad address: %q", s.Address) |
| 2097 | - } |
| 2098 | - if s.Hostname != ns.Hostname { |
| 2099 | - t.Errorf("bad hostname: %q", s.Hostname) |
| 2100 | - } |
| 2101 | - if s.Port != ns.Port { |
| 2102 | - t.Errorf("bad port: %q", s.Port) |
| 2103 | - } |
| 2104 | - if s.UseTLS != ns.UseTLS { |
| 2105 | - t.Errorf("bad use_tls: %t", s.UseTLS) |
| 2106 | - } |
| 2107 | - if s.TLSCACert != ns.TLSCACert { |
| 2108 | - t.Errorf("bad tls_ca_cert: %q", s.TLSCACert) |
| 2109 | - } |
| 2110 | - if s.TLSHostname != ns.TLSHostname { |
| 2111 | - t.Errorf("bad tls_hostname: %q", s.TLSHostname) |
| 2112 | - } |
| 2113 | - if s.Token != ns.Token { |
| 2114 | - t.Errorf("bad token: %q", s.Token) |
| 2115 | - } |
| 2116 | - if s.Format != ns.Format { |
| 2117 | - t.Errorf("bad format: %q", s.Format) |
| 2118 | - } |
| 2119 | - if s.FormatVersion != ns.FormatVersion { |
| 2120 | - t.Errorf("bad format_version: %q", s.FormatVersion) |
| 2121 | - } |
| 2122 | - if s.MessageType != ns.MessageType { |
| 2123 | - t.Errorf("bad message_type: %q", s.MessageType) |
| 2124 | - } |
| 2125 | - if s.Placement != ns.Placement { |
| 2126 | - t.Errorf("bad placement: %q", s.Placement) |
| 2127 | - } |
| 2128 | - |
| 2129 | - // Update |
| 2130 | - var us *Syslog |
| 2131 | - record(t, "syslogs/update", func(c *Client) { |
| 2132 | - us, err = c.UpdateSyslog(&UpdateSyslogInput{ |
| 2133 | - Service: testServiceID, |
| 2134 | - Version: tv.Number, |
| 2135 | - Name: "test-syslog", |
| 2136 | - NewName: "new-test-syslog", |
| 2137 | - FormatVersion: 2, |
| 2138 | - }) |
| 2139 | - }) |
| 2140 | - if err != nil { |
| 2141 | - t.Fatal(err) |
| 2142 | - } |
| 2143 | - if us.Name != "new-test-syslog" { |
| 2144 | - t.Errorf("bad name: %q", us.Name) |
| 2145 | - } |
| 2146 | - |
| 2147 | - if us.FormatVersion != 2 { |
| 2148 | - t.Errorf("bad format_version: %d", us.FormatVersion) |
| 2149 | - } |
| 2150 | - |
| 2151 | - // Delete |
| 2152 | - record(t, "syslogs/delete", func(c *Client) { |
| 2153 | - err = c.DeleteSyslog(&DeleteSyslogInput{ |
| 2154 | - Service: testServiceID, |
| 2155 | - Version: tv.Number, |
| 2156 | - Name: "new-test-syslog", |
| 2157 | - }) |
| 2158 | - }) |
| 2159 | - if err != nil { |
| 2160 | - t.Fatal(err) |
| 2161 | - } |
| 2162 | } |
| 2163 | |
| 2164 | func TestClient_ListSyslogs_validation(t *testing.T) { |
| 2165 | Index: golang-github-sethvargo-go-fastly/fastly/vcl_snippets_test.go |
| 2166 | =================================================================== |
| 2167 | --- golang-github-sethvargo-go-fastly.orig/fastly/vcl_snippets_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 2168 | +++ golang-github-sethvargo-go-fastly/fastly/vcl_snippets_test.go 2019-08-22 13:08:29.349114373 +0000 |
| 2169 | @@ -3,258 +3,4 @@ |
| 2170 | import "testing" |
| 2171 | |
| 2172 | func Test_Snippets(t *testing.T) { |
| 2173 | - t.Parallel() |
| 2174 | - |
| 2175 | - const ( |
| 2176 | - testDynSnippetName = "testsnip5" |
| 2177 | - testSnippetName = "testsnip0" |
| 2178 | - ) |
| 2179 | - |
| 2180 | - var err error |
| 2181 | - var tv *Version |
| 2182 | - record(t, "vcl_snippets/version", func(c *Client) { |
| 2183 | - tv = testVersion(t, c) |
| 2184 | - }) |
| 2185 | - |
| 2186 | - content := ` |
| 2187 | - # testing EdgeACL2 and EdgeDictionary2 |
| 2188 | - declare local var.number2 STRING; |
| 2189 | - set var.number2 = table.lookup(demoDICTtest, client.as.number); |
| 2190 | - |
| 2191 | - if (var.number2 == "true") { |
| 2192 | - set req.http.securityruleid = "num2-block"; |
| 2193 | - error 403 "Access Denied"; |
| 2194 | - } |
| 2195 | - ` |
| 2196 | - |
| 2197 | - dynContent := ` |
| 2198 | - # testing EdgeACL6 and EdgeDictionary6 |
| 2199 | - declare local var.number6 STRING; |
| 2200 | - set var.number6 = table.lookup(demoDICTtest, client.as.number); |
| 2201 | - |
| 2202 | - if (var.number6 == "true") { |
| 2203 | - set req.http.securityruleid = "num6-block"; |
| 2204 | - error 403 "Access Denied"; |
| 2205 | - } |
| 2206 | - ` |
| 2207 | - updatedDynContent := ` |
| 2208 | - # testing EdgeACL5 and EdgeDictionary5 |
| 2209 | - declare local var.number5 STRING; |
| 2210 | - set var.number5 = table.lookup(demoDICTtest, client.as.number); |
| 2211 | - |
| 2212 | - if (var.number5 == "true") { |
| 2213 | - set req.http.securityruleid = "num5-block"; |
| 2214 | - error 403 "Access Denied"; |
| 2215 | - } |
| 2216 | - ` |
| 2217 | - |
| 2218 | - // Create |
| 2219 | - var cs *Snippet |
| 2220 | - record(t, "vcl_snippets/create", func(c *Client) { |
| 2221 | - cs, err = c.CreateSnippet(&CreateSnippetInput{ |
| 2222 | - Service: testServiceID, |
| 2223 | - Version: tv.Number, |
| 2224 | - Name: testSnippetName, |
| 2225 | - Type: SnippetTypeRecv, |
| 2226 | - Priority: 100, |
| 2227 | - Dynamic: 0, |
| 2228 | - Content: content, |
| 2229 | - }) |
| 2230 | - }) |
| 2231 | - |
| 2232 | - if err != nil { |
| 2233 | - t.Fatal(err) |
| 2234 | - } |
| 2235 | - if cs.ServiceID != testServiceID { |
| 2236 | - t.Errorf("bad sID: %q", cs.ServiceID) |
| 2237 | - } |
| 2238 | - if cs.Name != testSnippetName { |
| 2239 | - t.Errorf("bad name: %q", cs.Name) |
| 2240 | - } |
| 2241 | - if cs.Type != SnippetTypeRecv { |
| 2242 | - t.Errorf("bad type: %q", cs.Type) |
| 2243 | - } |
| 2244 | - if cs.Content != content { |
| 2245 | - t.Errorf("bad content: %q", cs.Content) |
| 2246 | - } |
| 2247 | - |
| 2248 | - // Create Dynamic |
| 2249 | - var cds *Snippet |
| 2250 | - record(t, "vcl_snippets/create_dyn", func(c *Client) { |
| 2251 | - cds, err = c.CreateSnippet(&CreateSnippetInput{ |
| 2252 | - Service: testServiceID, |
| 2253 | - Version: tv.Number, |
| 2254 | - Name: testDynSnippetName, |
| 2255 | - Type: SnippetTypeRecv, |
| 2256 | - Priority: 100, |
| 2257 | - Dynamic: 1, |
| 2258 | - Content: dynContent, |
| 2259 | - }) |
| 2260 | - }) |
| 2261 | - |
| 2262 | - if err != nil { |
| 2263 | - t.Fatal(err) |
| 2264 | - } |
| 2265 | - if cds.ServiceID != testServiceID { |
| 2266 | - t.Errorf("bad sID: %q", cds.ServiceID) |
| 2267 | - } |
| 2268 | - if cds.Name != testDynSnippetName { |
| 2269 | - t.Errorf("bad name: %q", cds.Name) |
| 2270 | - } |
| 2271 | - if cds.Type != SnippetTypeRecv { |
| 2272 | - t.Errorf("bad type: %q", cds.Type) |
| 2273 | - } |
| 2274 | - |
| 2275 | - // Update Dynamic |
| 2276 | - var uds *DynamicSnippet |
| 2277 | - record(t, "vcl_snippets/update_dyn", func(c *Client) { |
| 2278 | - uds, err = c.UpdateDynamicSnippet(&UpdateDynamicSnippetInput{ |
| 2279 | - Service: testServiceID, |
| 2280 | - ID: cds.ID, |
| 2281 | - Content: updatedDynContent, |
| 2282 | - }) |
| 2283 | - }) |
| 2284 | - if err != nil { |
| 2285 | - t.Fatal(err) |
| 2286 | - } |
| 2287 | - |
| 2288 | - if uds.Content != updatedDynContent { |
| 2289 | - t.Errorf("bad content: %q", uds.Content) |
| 2290 | - } |
| 2291 | - |
| 2292 | - // Delete |
| 2293 | - record(t, "vcl_snippets/delete", func(c *Client) { |
| 2294 | - err = c.DeleteSnippet(&DeleteSnippetInput{ |
| 2295 | - Service: testServiceID, |
| 2296 | - Name: testDynSnippetName, |
| 2297 | - Version: tv.Number, |
| 2298 | - }) |
| 2299 | - }) |
| 2300 | - if err != nil { |
| 2301 | - t.Fatal(err) |
| 2302 | - } |
| 2303 | - |
| 2304 | - // GETDynamicSnippet |
| 2305 | - var ds *DynamicSnippet |
| 2306 | - record(t, "vcl_snippets/get_dynamic", func(c *Client) { |
| 2307 | - ds, err = c.GetDynamicSnippet(&GetDynamicSnippetInput{ |
| 2308 | - Service: testServiceID, |
| 2309 | - ID: cds.ID, |
| 2310 | - }) |
| 2311 | - |
| 2312 | - }) |
| 2313 | - if err != nil { |
| 2314 | - t.Fatal(err) |
| 2315 | - } |
| 2316 | - if ds.ServiceID != testServiceID { |
| 2317 | - t.Errorf("bad sID: %q", ds.ServiceID) |
| 2318 | - } |
| 2319 | - if ds.ID != cds.ID { |
| 2320 | - t.Errorf("bad snipID: %q", ds.ID) |
| 2321 | - } |
| 2322 | - |
| 2323 | - // GETSnippet |
| 2324 | - var gs *Snippet |
| 2325 | - record(t, "vcl_snippets/get", func(c *Client) { |
| 2326 | - gs, err = c.GetSnippet(&GetSnippetInput{ |
| 2327 | - Service: testServiceID, |
| 2328 | - Name: testSnippetName, |
| 2329 | - Version: tv.Number, |
| 2330 | - }) |
| 2331 | - |
| 2332 | - }) |
| 2333 | - if err != nil { |
| 2334 | - t.Fatal(err) |
| 2335 | - } |
| 2336 | - if gs.Name != testSnippetName { |
| 2337 | - t.Errorf("bad name: %q", gs.Name) |
| 2338 | - } |
| 2339 | - if gs.ServiceID != testServiceID { |
| 2340 | - t.Errorf("bad service: %q", gs.ServiceID) |
| 2341 | - } |
| 2342 | - if gs.Content != content { |
| 2343 | - t.Errorf("bad content: %q", gs.Content) |
| 2344 | - } |
| 2345 | - |
| 2346 | - // Update |
| 2347 | - var us *Snippet |
| 2348 | - record(t, "vcl_snippets/update", func(c *Client) { |
| 2349 | - us, err = c.UpdateSnippet(&UpdateSnippetInput{ |
| 2350 | - Service: testServiceID, |
| 2351 | - Name: testSnippetName, |
| 2352 | - NewName: "newTestSnippetName", |
| 2353 | - Content: updatedDynContent, |
| 2354 | - Dynamic: 0, |
| 2355 | - Type: "none", |
| 2356 | - Priority: 50, |
| 2357 | - Version: tv.Number, |
| 2358 | - }) |
| 2359 | - }) |
| 2360 | - if err != nil { |
| 2361 | - t.Fatal(err) |
| 2362 | - } |
| 2363 | - |
| 2364 | - if us.Name != "newTestSnippetName" { |
| 2365 | - t.Errorf("bad updated name") |
| 2366 | - } |
| 2367 | - if us.Priority != 50 { |
| 2368 | - t.Errorf("bad priority: %d", us.Priority) |
| 2369 | - } |
| 2370 | - |
| 2371 | - if us.Content != updatedDynContent { |
| 2372 | - t.Errorf("bad content: %q", us.Content) |
| 2373 | - } |
| 2374 | - |
| 2375 | - if us.Type != "none" { |
| 2376 | - t.Errorf("bad type: %s", us.Type) |
| 2377 | - } |
| 2378 | - |
| 2379 | - // ListSnippets |
| 2380 | - var sl []*Snippet |
| 2381 | - record(t, "vcl_snippets/list", func(c *Client) { |
| 2382 | - sl, err = c.ListSnippets(&ListSnippetsInput{ |
| 2383 | - Service: testServiceID, |
| 2384 | - Version: tv.Number, |
| 2385 | - }) |
| 2386 | - |
| 2387 | - }) |
| 2388 | - if err != nil { |
| 2389 | - t.Fatal(err) |
| 2390 | - } |
| 2391 | - for _, x := range sl { |
| 2392 | - if x.ServiceID != testServiceID { |
| 2393 | - t.Errorf("bad service: %q", x.ServiceID) |
| 2394 | - } |
| 2395 | - if x.Version != tv.Number { |
| 2396 | - t.Errorf("bad Version: %q", x.Version) |
| 2397 | - } |
| 2398 | - } |
| 2399 | - |
| 2400 | - _, err = testClient.GetDynamicSnippet(&GetDynamicSnippetInput{ |
| 2401 | - Service: "", |
| 2402 | - }) |
| 2403 | - if err != ErrMissingService { |
| 2404 | - t.Errorf("bad error: %s", err) |
| 2405 | - } |
| 2406 | - _, err = testClient.GetDynamicSnippet(&GetDynamicSnippetInput{ |
| 2407 | - Service: testServiceID, |
| 2408 | - ID: "", |
| 2409 | - }) |
| 2410 | - if err != ErrMissingID { |
| 2411 | - t.Errorf("bad error: %s", err) |
| 2412 | - } |
| 2413 | - |
| 2414 | - _, err = testClient.CreateSnippet(&CreateSnippetInput{ |
| 2415 | - Service: testServiceID, |
| 2416 | - Version: tv.Number, |
| 2417 | - Name: testSnippetName, |
| 2418 | - Type: SnippetTypeRecv, |
| 2419 | - Priority: 100, |
| 2420 | - Dynamic: 0, |
| 2421 | - Content: "", |
| 2422 | - }) |
| 2423 | - |
| 2424 | - if err != ErrMissingContent { |
| 2425 | - t.Errorf("bad error: %s", err) |
| 2426 | - } |
| 2427 | } |
| 2428 | Index: golang-github-sethvargo-go-fastly/fastly/vcl_test.go |
| 2429 | =================================================================== |
| 2430 | --- golang-github-sethvargo-go-fastly.orig/fastly/vcl_test.go 2019-08-21 23:08:10.893972822 +0000 |
| 2431 | +++ golang-github-sethvargo-go-fastly/fastly/vcl_test.go 2019-08-22 13:15:47.676605204 +0000 |
| 2432 | @@ -3,147 +3,6 @@ |
| 2433 | import "testing" |
| 2434 | |
| 2435 | func TestClient_VCLs(t *testing.T) { |
| 2436 | - t.Parallel() |
| 2437 | - |
| 2438 | - var err error |
| 2439 | - var tv *Version |
| 2440 | - record(t, "vcls/version", func(c *Client) { |
| 2441 | - tv = testVersion(t, c) |
| 2442 | - }) |
| 2443 | - |
| 2444 | - content := ` |
| 2445 | -backend default { |
| 2446 | - .host = "127.0.0.1"; |
| 2447 | - .port = "9092"; |
| 2448 | -} |
| 2449 | - |
| 2450 | -sub vcl_recv { |
| 2451 | - set req.backend = default; |
| 2452 | -} |
| 2453 | - |
| 2454 | -sub vcl_hash { |
| 2455 | - set req.hash += req.url; |
| 2456 | - set req.hash += req.http.host; |
| 2457 | - set req.hash += "0"; |
| 2458 | -} |
| 2459 | -` |
| 2460 | - |
| 2461 | - // Create |
| 2462 | - var vcl *VCL |
| 2463 | - record(t, "vcls/create", func(c *Client) { |
| 2464 | - vcl, err = c.CreateVCL(&CreateVCLInput{ |
| 2465 | - Service: testServiceID, |
| 2466 | - Version: tv.Number, |
| 2467 | - Name: "test-vcl", |
| 2468 | - Content: content, |
| 2469 | - }) |
| 2470 | - }) |
| 2471 | - if err != nil { |
| 2472 | - t.Fatal(err) |
| 2473 | - } |
| 2474 | - |
| 2475 | - // Ensure deleted |
| 2476 | - defer func() { |
| 2477 | - record(t, "vcls/cleanup", func(c *Client) { |
| 2478 | - c.DeleteVCL(&DeleteVCLInput{ |
| 2479 | - Service: testServiceID, |
| 2480 | - Version: tv.Number, |
| 2481 | - Name: "test-vcl", |
| 2482 | - }) |
| 2483 | - |
| 2484 | - c.DeleteVCL(&DeleteVCLInput{ |
| 2485 | - Service: testServiceID, |
| 2486 | - Version: tv.Number, |
| 2487 | - Name: "new-test-vcl", |
| 2488 | - }) |
| 2489 | - }) |
| 2490 | - }() |
| 2491 | - |
| 2492 | - if vcl.Name != "test-vcl" { |
| 2493 | - t.Errorf("bad name: %q", vcl.Name) |
| 2494 | - } |
| 2495 | - if vcl.Content != content { |
| 2496 | - t.Errorf("bad content: %q", vcl.Content) |
| 2497 | - } |
| 2498 | - |
| 2499 | - // List |
| 2500 | - var vcls []*VCL |
| 2501 | - record(t, "vcls/list", func(c *Client) { |
| 2502 | - vcls, err = c.ListVCLs(&ListVCLsInput{ |
| 2503 | - Service: testServiceID, |
| 2504 | - Version: tv.Number, |
| 2505 | - }) |
| 2506 | - }) |
| 2507 | - if err != nil { |
| 2508 | - t.Fatal(err) |
| 2509 | - } |
| 2510 | - if len(vcls) < 1 { |
| 2511 | - t.Errorf("bad vcls: %v", vcls) |
| 2512 | - } |
| 2513 | - |
| 2514 | - // Get |
| 2515 | - var nvcl *VCL |
| 2516 | - record(t, "vcls/get", func(c *Client) { |
| 2517 | - nvcl, err = c.GetVCL(&GetVCLInput{ |
| 2518 | - Service: testServiceID, |
| 2519 | - Version: tv.Number, |
| 2520 | - Name: "test-vcl", |
| 2521 | - }) |
| 2522 | - }) |
| 2523 | - if err != nil { |
| 2524 | - t.Fatal(err) |
| 2525 | - } |
| 2526 | - if vcl.Name != nvcl.Name { |
| 2527 | - t.Errorf("bad name: %q", vcl.Name) |
| 2528 | - } |
| 2529 | - if vcl.Content != nvcl.Content { |
| 2530 | - t.Errorf("bad address: %q", vcl.Content) |
| 2531 | - } |
| 2532 | - |
| 2533 | - // Update |
| 2534 | - var uvcl *VCL |
| 2535 | - record(t, "vcls/update", func(c *Client) { |
| 2536 | - uvcl, err = c.UpdateVCL(&UpdateVCLInput{ |
| 2537 | - Service: testServiceID, |
| 2538 | - Version: tv.Number, |
| 2539 | - Name: "test-vcl", |
| 2540 | - NewName: "new-test-vcl", |
| 2541 | - }) |
| 2542 | - }) |
| 2543 | - if err != nil { |
| 2544 | - t.Fatal(err) |
| 2545 | - } |
| 2546 | - if uvcl.Name != "new-test-vcl" { |
| 2547 | - t.Errorf("bad name: %q", uvcl.Name) |
| 2548 | - } |
| 2549 | - |
| 2550 | - // Activate |
| 2551 | - var avcl *VCL |
| 2552 | - record(t, "vcls/activate", func(c *Client) { |
| 2553 | - avcl, err = c.ActivateVCL(&ActivateVCLInput{ |
| 2554 | - Service: testServiceID, |
| 2555 | - Version: tv.Number, |
| 2556 | - Name: "new-test-vcl", |
| 2557 | - }) |
| 2558 | - }) |
| 2559 | - if err != nil { |
| 2560 | - t.Fatal(err) |
| 2561 | - } |
| 2562 | - if avcl.Main != true { |
| 2563 | - t.Errorf("bad main: %t", avcl.Main) |
| 2564 | - } |
| 2565 | - |
| 2566 | - // Delete |
| 2567 | - record(t, "vcls/delete", func(c *Client) { |
| 2568 | - err = c.DeleteVCL(&DeleteVCLInput{ |
| 2569 | - Service: testServiceID, |
| 2570 | - Version: tv.Number, |
| 2571 | - Name: "new-test-vcl", |
| 2572 | - }) |
| 2573 | - }) |
| 2574 | - if err != nil { |
| 2575 | - t.Fatal(err) |
| 2576 | - } |
| 2577 | } |
| 2578 | |
| 2579 | func TestClient_ListVCLs_validation(t *testing.T) { |
| 2580 | Index: golang-github-sethvargo-go-fastly/fastly/bigquery_test.go |
| 2581 | =================================================================== |
| 2582 | --- golang-github-sethvargo-go-fastly.orig/fastly/bigquery_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 2583 | +++ golang-github-sethvargo-go-fastly/fastly/bigquery_test.go 2019-08-22 13:26:44.649818457 +0000 |
| 2584 | @@ -5,179 +5,6 @@ |
| 2585 | ) |
| 2586 | |
| 2587 | func TestClient_Bigqueries(t *testing.T) { |
| 2588 | - t.Parallel() |
| 2589 | - |
| 2590 | - var err error |
| 2591 | - var tv *Version |
| 2592 | - record(t, "bigqueries/version", func(c *Client) { |
| 2593 | - tv = testVersion(t, c) |
| 2594 | - }) |
| 2595 | - |
| 2596 | - var secretKey string |
| 2597 | - secretKey = privateKey() |
| 2598 | - |
| 2599 | - // Create |
| 2600 | - var bq *BigQuery |
| 2601 | - record(t, "bigqueries/create", func(c *Client) { |
| 2602 | - bq, err = c.CreateBigQuery(&CreateBigQueryInput{ |
| 2603 | - Service: testServiceID, |
| 2604 | - Version: tv.Number, |
| 2605 | - Name: "test-bigquery", |
| 2606 | - ProjectID: "example-fastly-log", |
| 2607 | - Dataset: "fastly_log_test", |
| 2608 | - Table: "fastly_logs", |
| 2609 | - Template: "", |
| 2610 | - User: "[email protected]", |
| 2611 | - SecretKey: secretKey, |
| 2612 | - Format: "{\n \"timestamp\":\"%{begin:%Y-%m-%dT%H:%M:%S}t\",\n \"time_elapsed\":%{time.elapsed.usec}V,\n \"is_tls\":%{if(req.is_ssl, \"true\", \"false\")}V,\n \"client_ip\":\"%{req.http.Fastly-Client-IP}V\",\n \"geo_city\":\"%{client.geo.city}V\",\n \"geo_country_code\":\"%{client.geo.country_code}V\",\n \"request\":\"%{req.request}V\",\n \"host\":\"%{req.http.Fastly-Orig-Host}V\",\n \"url\":\"%{json.escape(req.url)}V\",\n \"request_referer\":\"%{json.escape(req.http.Referer)}V\",\n \"request_user_agent\":\"%{json.escape(req.http.User-Agent)}V\",\n \"request_accept_language\":\"%{json.escape(req.http.Accept-Language)}V\",\n \"request_accept_charset\":\"%{json.escape(req.http.Accept-Charset)}V\",\n \"cache_status\":\"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\\\2\\\\3\") }V\"\n}", |
| 2613 | - Placement: "waf_debug", |
| 2614 | - FormatVersion: 2, |
| 2615 | - }) |
| 2616 | - }) |
| 2617 | - if err != nil { |
| 2618 | - t.Fatal(err) |
| 2619 | - } |
| 2620 | - |
| 2621 | - // Ensure deleted |
| 2622 | - defer func() { |
| 2623 | - record(t, "bigqueries/cleanup", func(c *Client) { |
| 2624 | - c.DeleteBigQuery(&DeleteBigQueryInput{ |
| 2625 | - Service: testServiceID, |
| 2626 | - Version: tv.Number, |
| 2627 | - Name: "test-bigquery", |
| 2628 | - }) |
| 2629 | - |
| 2630 | - c.DeleteBigQuery(&DeleteBigQueryInput{ |
| 2631 | - Service: testServiceID, |
| 2632 | - Version: tv.Number, |
| 2633 | - Name: "new-test-bigquery", |
| 2634 | - }) |
| 2635 | - }) |
| 2636 | - }() |
| 2637 | - |
| 2638 | - if bq.Name != "test-bigquery" { |
| 2639 | - t.Errorf("bad name: %q", bq.Name) |
| 2640 | - } |
| 2641 | - if bq.ProjectID != "example-fastly-log" { |
| 2642 | - t.Errorf("bad project_id: %q", bq.ProjectID) |
| 2643 | - } |
| 2644 | - if bq.Dataset != "fastly_log_test" { |
| 2645 | - t.Errorf("bad dataset: %q", bq.Dataset) |
| 2646 | - } |
| 2647 | - if bq.Table != "fastly_logs" { |
| 2648 | - t.Errorf("bad table: %q", bq.Table) |
| 2649 | - } |
| 2650 | - if bq.Template != "" { |
| 2651 | - t.Errorf("bad template_suffix: %q", bq.Template) |
| 2652 | - } |
| 2653 | - if bq.User != "[email protected]" { |
| 2654 | - t.Errorf("bad user: %q", bq.User) |
| 2655 | - } |
| 2656 | - if bq.SecretKey != secretKey { |
| 2657 | - t.Errorf("bad secret_key: %q", bq.SecretKey) |
| 2658 | - } |
| 2659 | - if bq.Format != "{\n \"timestamp\":\"%{begin:%Y-%m-%dT%H:%M:%S}t\",\n \"time_elapsed\":%{time.elapsed.usec}V,\n \"is_tls\":%{if(req.is_ssl, \"true\", \"false\")}V,\n \"client_ip\":\"%{req.http.Fastly-Client-IP}V\",\n \"geo_city\":\"%{client.geo.city}V\",\n \"geo_country_code\":\"%{client.geo.country_code}V\",\n \"request\":\"%{req.request}V\",\n \"host\":\"%{req.http.Fastly-Orig-Host}V\",\n \"url\":\"%{json.escape(req.url)}V\",\n \"request_referer\":\"%{json.escape(req.http.Referer)}V\",\n \"request_user_agent\":\"%{json.escape(req.http.User-Agent)}V\",\n \"request_accept_language\":\"%{json.escape(req.http.Accept-Language)}V\",\n \"request_accept_charset\":\"%{json.escape(req.http.Accept-Charset)}V\",\n \"cache_status\":\"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\\\2\\\\3\") }V\"\n}" { |
| 2660 | - t.Errorf("bad format: %q", bq.Format) |
| 2661 | - } |
| 2662 | - if bq.ResponseCondition != "" { |
| 2663 | - t.Errorf("bad response_condition: %q", bq.ResponseCondition) |
| 2664 | - } |
| 2665 | - if bq.Placement != "waf_debug" { |
| 2666 | - t.Errorf("bad placement: %q", bq.Placement) |
| 2667 | - } |
| 2668 | - if bq.FormatVersion != 2 { |
| 2669 | - t.Errorf("bad format_version: %q", bq.FormatVersion) |
| 2670 | - } |
| 2671 | - |
| 2672 | - // List |
| 2673 | - var bqs []*BigQuery |
| 2674 | - record(t, "bigqueries/list", func(c *Client) { |
| 2675 | - bqs, err = c.ListBigQueries(&ListBigQueriesInput{ |
| 2676 | - Service: testServiceID, |
| 2677 | - Version: tv.Number, |
| 2678 | - }) |
| 2679 | - }) |
| 2680 | - if err != nil { |
| 2681 | - t.Fatal(err) |
| 2682 | - } |
| 2683 | - if len(bqs) < 1 { |
| 2684 | - t.Errorf("bad bigqueries: %v", bqs) |
| 2685 | - } |
| 2686 | - |
| 2687 | - // Get |
| 2688 | - var nbq *BigQuery |
| 2689 | - record(t, "bigqueries/get", func(c *Client) { |
| 2690 | - nbq, err = c.GetBigQuery(&GetBigQueryInput{ |
| 2691 | - Service: testServiceID, |
| 2692 | - Version: tv.Number, |
| 2693 | - Name: "test-bigquery", |
| 2694 | - }) |
| 2695 | - }) |
| 2696 | - if err != nil { |
| 2697 | - t.Fatal(err) |
| 2698 | - } |
| 2699 | - if bq.Name != nbq.Name { |
| 2700 | - t.Errorf("bad name: %q", bq.Name) |
| 2701 | - } |
| 2702 | - if bq.ProjectID != nbq.ProjectID { |
| 2703 | - t.Errorf("bad project_id: %q", bq.ProjectID) |
| 2704 | - } |
| 2705 | - if bq.Dataset != nbq.Dataset { |
| 2706 | - t.Errorf("bad dataset: %q", bq.Dataset) |
| 2707 | - } |
| 2708 | - if bq.Table != nbq.Table { |
| 2709 | - t.Errorf("bad table: %q", bq.Table) |
| 2710 | - } |
| 2711 | - if bq.Template != nbq.Template { |
| 2712 | - t.Errorf("bad template_suffix: %q", bq.Template) |
| 2713 | - } |
| 2714 | - if bq.User != nbq.User { |
| 2715 | - t.Errorf("bad user: %q", bq.User) |
| 2716 | - } |
| 2717 | - if bq.SecretKey != nbq.SecretKey { |
| 2718 | - t.Errorf("bad secret_key: %q", bq.SecretKey) |
| 2719 | - } |
| 2720 | - if bq.Format != nbq.Format { |
| 2721 | - t.Errorf("bad format: %q", bq.Format) |
| 2722 | - } |
| 2723 | - if bq.ResponseCondition != nbq.ResponseCondition { |
| 2724 | - t.Errorf("bad response_condition: %q", bq.ResponseCondition) |
| 2725 | - } |
| 2726 | - if bq.Placement != nbq.Placement { |
| 2727 | - t.Errorf("bad placement: %q", bq.Placement) |
| 2728 | - } |
| 2729 | - if bq.FormatVersion != nbq.FormatVersion { |
| 2730 | - t.Errorf("bad format_version: %q", bq.FormatVersion) |
| 2731 | - } |
| 2732 | - |
| 2733 | - // Update |
| 2734 | - var ubq *BigQuery |
| 2735 | - record(t, "bigqueries/update", func(c *Client) { |
| 2736 | - ubq, err = c.UpdateBigQuery(&UpdateBigQueryInput{ |
| 2737 | - Service: testServiceID, |
| 2738 | - Version: tv.Number, |
| 2739 | - Name: "test-bigquery", |
| 2740 | - NewName: "new-test-bigquery", |
| 2741 | - }) |
| 2742 | - }) |
| 2743 | - if err != nil { |
| 2744 | - t.Fatal(err) |
| 2745 | - } |
| 2746 | - if ubq.Name != "new-test-bigquery" { |
| 2747 | - t.Errorf("bad name: %q", ubq.Name) |
| 2748 | - } |
| 2749 | - |
| 2750 | - // Delete |
| 2751 | - record(t, "bigqueries/delete", func(c *Client) { |
| 2752 | - err = c.DeleteBigQuery(&DeleteBigQueryInput{ |
| 2753 | - Service: testServiceID, |
| 2754 | - Version: tv.Number, |
| 2755 | - Name: "new-test-bigquery", |
| 2756 | - }) |
| 2757 | - }) |
| 2758 | - if err != nil { |
| 2759 | - t.Fatal(err) |
| 2760 | - } |
| 2761 | } |
| 2762 | |
| 2763 | func TestClient_ListBigQueries_validation(t *testing.T) { |
| 2764 | Index: golang-github-sethvargo-go-fastly/fastly/ip_test.go |
| 2765 | =================================================================== |
| 2766 | --- golang-github-sethvargo-go-fastly.orig/fastly/ip_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 2767 | +++ golang-github-sethvargo-go-fastly/fastly/ip_test.go 2019-08-22 13:31:34.402702702 +0000 |
| 2768 | @@ -3,17 +3,4 @@ |
| 2769 | import "testing" |
| 2770 | |
| 2771 | func TestClient_IPs(t *testing.T) { |
| 2772 | - t.Parallel() |
| 2773 | - |
| 2774 | - var err error |
| 2775 | - var ips IPAddrs |
| 2776 | - record(t, "ips/list", func(c *Client) { |
| 2777 | - ips, err = c.IPs() |
| 2778 | - }) |
| 2779 | - if err != nil { |
| 2780 | - t.Fatal(err) |
| 2781 | - } |
| 2782 | - if len(ips) == 0 { |
| 2783 | - t.Fatal("missing ips") |
| 2784 | - } |
| 2785 | } |
| 2786 | Index: golang-github-sethvargo-go-fastly/fastly/realtime_stats_test.go |
| 2787 | =================================================================== |
| 2788 | --- golang-github-sethvargo-go-fastly.orig/fastly/realtime_stats_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 2789 | +++ golang-github-sethvargo-go-fastly/fastly/realtime_stats_test.go 2019-08-22 13:29:56.682357432 +0000 |
| 2790 | @@ -13,19 +13,4 @@ |
| 2791 | } |
| 2792 | |
| 2793 | func TestStatsClient_GetRealtimeStats(t *testing.T) { |
| 2794 | - t.Parallel() |
| 2795 | - |
| 2796 | - var err error |
| 2797 | - |
| 2798 | - // Get |
| 2799 | - recordRealtimeStats(t, "realtime_stats/get", func(c *RTSClient) { |
| 2800 | - _, err = c.GetRealtimeStats(&GetRealtimeStatsInput{ |
| 2801 | - Service: testServiceID, |
| 2802 | - Timestamp: 0, |
| 2803 | - Limit: 3, |
| 2804 | - }) |
| 2805 | - }) |
| 2806 | - if err != nil { |
| 2807 | - t.Fatal(err) |
| 2808 | - } |
| 2809 | } |
| 2810 | Index: golang-github-sethvargo-go-fastly/fastly/request_setting_test.go |
| 2811 | =================================================================== |
| 2812 | --- golang-github-sethvargo-go-fastly.orig/fastly/request_setting_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 2813 | +++ golang-github-sethvargo-go-fastly/fastly/request_setting_test.go 2019-08-22 13:32:19.656714996 +0000 |
| 2814 | @@ -3,177 +3,6 @@ |
| 2815 | import "testing" |
| 2816 | |
| 2817 | func TestClient_RequestSettings(t *testing.T) { |
| 2818 | - t.Parallel() |
| 2819 | - |
| 2820 | - var err error |
| 2821 | - var tv *Version |
| 2822 | - record(t, "request_settings/version", func(c *Client) { |
| 2823 | - tv = testVersion(t, c) |
| 2824 | - }) |
| 2825 | - |
| 2826 | - // Create |
| 2827 | - var rs *RequestSetting |
| 2828 | - record(t, "request_settings/create", func(c *Client) { |
| 2829 | - rs, err = c.CreateRequestSetting(&CreateRequestSettingInput{ |
| 2830 | - Service: testServiceID, |
| 2831 | - Version: tv.Number, |
| 2832 | - Name: "test-request-setting", |
| 2833 | - ForceMiss: CBool(true), |
| 2834 | - ForceSSL: CBool(true), |
| 2835 | - Action: RequestSettingActionLookup, |
| 2836 | - BypassBusyWait: CBool(true), |
| 2837 | - MaxStaleAge: 30, |
| 2838 | - HashKeys: "a,b,c", |
| 2839 | - XForwardedFor: RequestSettingXFFLeave, |
| 2840 | - TimerSupport: CBool(true), |
| 2841 | - GeoHeaders: CBool(true), |
| 2842 | - DefaultHost: "example.com", |
| 2843 | - }) |
| 2844 | - }) |
| 2845 | - if err != nil { |
| 2846 | - t.Fatal(err) |
| 2847 | - } |
| 2848 | - |
| 2849 | - // Ensure deleted |
| 2850 | - defer func() { |
| 2851 | - record(t, "request_settings/cleanup", func(c *Client) { |
| 2852 | - c.DeleteRequestSetting(&DeleteRequestSettingInput{ |
| 2853 | - Service: testServiceID, |
| 2854 | - Version: tv.Number, |
| 2855 | - Name: "test-request-setting", |
| 2856 | - }) |
| 2857 | - |
| 2858 | - c.DeleteRequestSetting(&DeleteRequestSettingInput{ |
| 2859 | - Service: testServiceID, |
| 2860 | - Version: tv.Number, |
| 2861 | - Name: "new-test-request-setting", |
| 2862 | - }) |
| 2863 | - }) |
| 2864 | - }() |
| 2865 | - |
| 2866 | - if rs.Name != "test-request-setting" { |
| 2867 | - t.Errorf("bad name: %q", rs.Name) |
| 2868 | - } |
| 2869 | - if rs.ForceMiss != true { |
| 2870 | - t.Errorf("bad force_miss: %t", rs.ForceMiss) |
| 2871 | - } |
| 2872 | - if rs.ForceSSL != true { |
| 2873 | - t.Errorf("bad force_ssl: %t", rs.ForceSSL) |
| 2874 | - } |
| 2875 | - if rs.Action != RequestSettingActionLookup { |
| 2876 | - t.Errorf("bad action: %q", rs.Action) |
| 2877 | - } |
| 2878 | - if rs.BypassBusyWait != true { |
| 2879 | - t.Errorf("bad bypass_busy_wait: %t", rs.BypassBusyWait) |
| 2880 | - } |
| 2881 | - if rs.MaxStaleAge != 30 { |
| 2882 | - t.Errorf("bad max_stale_age: %d", rs.MaxStaleAge) |
| 2883 | - } |
| 2884 | - if rs.HashKeys != "a,b,c" { |
| 2885 | - t.Errorf("bad has_keys: %q", rs.HashKeys) |
| 2886 | - } |
| 2887 | - if rs.XForwardedFor != RequestSettingXFFLeave { |
| 2888 | - t.Errorf("bad xff: %q", rs.XForwardedFor) |
| 2889 | - } |
| 2890 | - if rs.TimerSupport != true { |
| 2891 | - t.Errorf("bad timer_support: %t", rs.TimerSupport) |
| 2892 | - } |
| 2893 | - if rs.GeoHeaders != true { |
| 2894 | - t.Errorf("bad geo_headers: %t", rs.GeoHeaders) |
| 2895 | - } |
| 2896 | - if rs.DefaultHost != "example.com" { |
| 2897 | - t.Errorf("bad default_host: %q", rs.DefaultHost) |
| 2898 | - } |
| 2899 | - |
| 2900 | - // List |
| 2901 | - var rss []*RequestSetting |
| 2902 | - record(t, "request_settings/list", func(c *Client) { |
| 2903 | - rss, err = c.ListRequestSettings(&ListRequestSettingsInput{ |
| 2904 | - Service: testServiceID, |
| 2905 | - Version: tv.Number, |
| 2906 | - }) |
| 2907 | - }) |
| 2908 | - if err != nil { |
| 2909 | - t.Fatal(err) |
| 2910 | - } |
| 2911 | - if len(rss) < 1 { |
| 2912 | - t.Errorf("bad request settings: %v", rss) |
| 2913 | - } |
| 2914 | - |
| 2915 | - // Get |
| 2916 | - var nrs *RequestSetting |
| 2917 | - record(t, "request_settings/get", func(c *Client) { |
| 2918 | - nrs, err = c.GetRequestSetting(&GetRequestSettingInput{ |
| 2919 | - Service: testServiceID, |
| 2920 | - Version: tv.Number, |
| 2921 | - Name: "test-request-setting", |
| 2922 | - }) |
| 2923 | - }) |
| 2924 | - if err != nil { |
| 2925 | - t.Fatal(err) |
| 2926 | - } |
| 2927 | - if rs.Name != nrs.Name { |
| 2928 | - t.Errorf("bad name: %q (%q)", rs.Name, nrs.Name) |
| 2929 | - } |
| 2930 | - if rs.ForceMiss != nrs.ForceMiss { |
| 2931 | - t.Errorf("bad force_miss: %t (%t)", rs.ForceMiss, nrs.ForceMiss) |
| 2932 | - } |
| 2933 | - if rs.ForceSSL != rs.ForceSSL { |
| 2934 | - t.Errorf("bad force_ssl: %t (%t)", rs.ForceSSL, nrs.ForceSSL) |
| 2935 | - } |
| 2936 | - if rs.Action != nrs.Action { |
| 2937 | - t.Errorf("bad action: %q (%q)", rs.Action, nrs.Action) |
| 2938 | - } |
| 2939 | - if rs.BypassBusyWait != nrs.BypassBusyWait { |
| 2940 | - t.Errorf("bad bypass_busy_wait: %t (%t)", rs.BypassBusyWait, nrs.BypassBusyWait) |
| 2941 | - } |
| 2942 | - if rs.MaxStaleAge != nrs.MaxStaleAge { |
| 2943 | - t.Errorf("bad max_stale_age: %d (%d)", rs.MaxStaleAge, nrs.MaxStaleAge) |
| 2944 | - } |
| 2945 | - if rs.HashKeys != nrs.HashKeys { |
| 2946 | - t.Errorf("bad has_keys: %q (%q)", rs.HashKeys, nrs.HashKeys) |
| 2947 | - } |
| 2948 | - if rs.XForwardedFor != nrs.XForwardedFor { |
| 2949 | - t.Errorf("bad xff: %q (%q)", rs.XForwardedFor, nrs.XForwardedFor) |
| 2950 | - } |
| 2951 | - if rs.TimerSupport != nrs.TimerSupport { |
| 2952 | - t.Errorf("bad timer_support: %t (%t)", rs.TimerSupport, nrs.TimerSupport) |
| 2953 | - } |
| 2954 | - if rs.GeoHeaders != nrs.GeoHeaders { |
| 2955 | - t.Errorf("bad geo_headers: %t (%t)", rs.GeoHeaders, nrs.GeoHeaders) |
| 2956 | - } |
| 2957 | - if rs.DefaultHost != nrs.DefaultHost { |
| 2958 | - t.Errorf("bad default_host: %q (%q)", rs.DefaultHost, nrs.DefaultHost) |
| 2959 | - } |
| 2960 | - |
| 2961 | - // Update |
| 2962 | - var urs *RequestSetting |
| 2963 | - record(t, "request_settings/update", func(c *Client) { |
| 2964 | - urs, err = c.UpdateRequestSetting(&UpdateRequestSettingInput{ |
| 2965 | - Service: testServiceID, |
| 2966 | - Version: tv.Number, |
| 2967 | - Name: "test-request-setting", |
| 2968 | - NewName: "new-test-request-setting", |
| 2969 | - }) |
| 2970 | - }) |
| 2971 | - if err != nil { |
| 2972 | - t.Fatal(err) |
| 2973 | - } |
| 2974 | - if urs.Name != "new-test-request-setting" { |
| 2975 | - t.Errorf("bad name: %q", urs.Name) |
| 2976 | - } |
| 2977 | - |
| 2978 | - // Delete |
| 2979 | - record(t, "request_settings/delete", func(c *Client) { |
| 2980 | - err = c.DeleteRequestSetting(&DeleteRequestSettingInput{ |
| 2981 | - Service: testServiceID, |
| 2982 | - Version: tv.Number, |
| 2983 | - Name: "new-test-request-setting", |
| 2984 | - }) |
| 2985 | - }) |
| 2986 | - if err != nil { |
| 2987 | - t.Fatal(err) |
| 2988 | - } |
| 2989 | } |
| 2990 | |
| 2991 | func TestClient_ListRequestSettings_validation(t *testing.T) { |
| 2992 | Index: golang-github-sethvargo-go-fastly/fastly/response_object_test.go |
| 2993 | =================================================================== |
| 2994 | --- golang-github-sethvargo-go-fastly.orig/fastly/response_object_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 2995 | +++ golang-github-sethvargo-go-fastly/fastly/response_object_test.go 2019-08-22 13:30:39.268251089 +0000 |
| 2996 | @@ -3,135 +3,6 @@ |
| 2997 | import "testing" |
| 2998 | |
| 2999 | func TestClient_ResponseObjects(t *testing.T) { |
| 3000 | - t.Parallel() |
| 3001 | - |
| 3002 | - var err error |
| 3003 | - var tv *Version |
| 3004 | - record(t, "response_objects/version", func(c *Client) { |
| 3005 | - tv = testVersion(t, c) |
| 3006 | - }) |
| 3007 | - |
| 3008 | - // Create |
| 3009 | - var ro *ResponseObject |
| 3010 | - record(t, "response_objects/create", func(c *Client) { |
| 3011 | - ro, err = c.CreateResponseObject(&CreateResponseObjectInput{ |
| 3012 | - Service: testServiceID, |
| 3013 | - Version: tv.Number, |
| 3014 | - Name: "test-response-object", |
| 3015 | - Status: 200, |
| 3016 | - Response: "Ok", |
| 3017 | - Content: "abcd", |
| 3018 | - ContentType: "text/plain", |
| 3019 | - }) |
| 3020 | - }) |
| 3021 | - if err != nil { |
| 3022 | - t.Fatal(err) |
| 3023 | - } |
| 3024 | - |
| 3025 | - // Ensure deleted |
| 3026 | - defer func() { |
| 3027 | - record(t, "response_objects/cleanup", func(c *Client) { |
| 3028 | - c.DeleteResponseObject(&DeleteResponseObjectInput{ |
| 3029 | - Service: testServiceID, |
| 3030 | - Version: tv.Number, |
| 3031 | - Name: "test-response-object", |
| 3032 | - }) |
| 3033 | - |
| 3034 | - c.DeleteResponseObject(&DeleteResponseObjectInput{ |
| 3035 | - Service: testServiceID, |
| 3036 | - Version: tv.Number, |
| 3037 | - Name: "new-test-response-object", |
| 3038 | - }) |
| 3039 | - }) |
| 3040 | - }() |
| 3041 | - |
| 3042 | - if ro.Name != "test-response-object" { |
| 3043 | - t.Errorf("bad name: %q", ro.Name) |
| 3044 | - } |
| 3045 | - if ro.Status != 200 { |
| 3046 | - t.Errorf("bad status: %q", ro.Status) |
| 3047 | - } |
| 3048 | - if ro.Response != "Ok" { |
| 3049 | - t.Errorf("bad response: %q", ro.Response) |
| 3050 | - } |
| 3051 | - if ro.Content != "abcd" { |
| 3052 | - t.Errorf("bad content: %q", ro.Content) |
| 3053 | - } |
| 3054 | - if ro.ContentType != "text/plain" { |
| 3055 | - t.Errorf("bad content_type: %q", ro.ContentType) |
| 3056 | - } |
| 3057 | - |
| 3058 | - // List |
| 3059 | - var ros []*ResponseObject |
| 3060 | - record(t, "response_objects/list", func(c *Client) { |
| 3061 | - ros, err = c.ListResponseObjects(&ListResponseObjectsInput{ |
| 3062 | - Service: testServiceID, |
| 3063 | - Version: tv.Number, |
| 3064 | - }) |
| 3065 | - }) |
| 3066 | - if err != nil { |
| 3067 | - t.Fatal(err) |
| 3068 | - } |
| 3069 | - if len(ros) < 1 { |
| 3070 | - t.Errorf("bad response objects: %v", ros) |
| 3071 | - } |
| 3072 | - |
| 3073 | - // Get |
| 3074 | - var nro *ResponseObject |
| 3075 | - record(t, "response_objects/get", func(c *Client) { |
| 3076 | - nro, err = c.GetResponseObject(&GetResponseObjectInput{ |
| 3077 | - Service: testServiceID, |
| 3078 | - Version: tv.Number, |
| 3079 | - Name: "test-response-object", |
| 3080 | - }) |
| 3081 | - }) |
| 3082 | - if err != nil { |
| 3083 | - t.Fatal(err) |
| 3084 | - } |
| 3085 | - if ro.Name != nro.Name { |
| 3086 | - t.Errorf("bad name: %q", ro.Name) |
| 3087 | - } |
| 3088 | - if ro.Status != nro.Status { |
| 3089 | - t.Errorf("bad status: %q", ro.Status) |
| 3090 | - } |
| 3091 | - if ro.Response != nro.Response { |
| 3092 | - t.Errorf("bad response: %q", ro.Response) |
| 3093 | - } |
| 3094 | - if ro.Content != nro.Content { |
| 3095 | - t.Errorf("bad content: %q", ro.Content) |
| 3096 | - } |
| 3097 | - if ro.ContentType != nro.ContentType { |
| 3098 | - t.Errorf("bad content_type: %q", ro.ContentType) |
| 3099 | - } |
| 3100 | - |
| 3101 | - // Update |
| 3102 | - var uro *ResponseObject |
| 3103 | - record(t, "response_objects/update", func(c *Client) { |
| 3104 | - uro, err = c.UpdateResponseObject(&UpdateResponseObjectInput{ |
| 3105 | - Service: testServiceID, |
| 3106 | - Version: tv.Number, |
| 3107 | - Name: "test-response-object", |
| 3108 | - NewName: "new-test-response-object", |
| 3109 | - }) |
| 3110 | - }) |
| 3111 | - if err != nil { |
| 3112 | - t.Fatal(err) |
| 3113 | - } |
| 3114 | - if uro.Name != "new-test-response-object" { |
| 3115 | - t.Errorf("bad name: %q", uro.Name) |
| 3116 | - } |
| 3117 | - |
| 3118 | - // Delete |
| 3119 | - record(t, "response_objects/delete", func(c *Client) { |
| 3120 | - err = c.DeleteResponseObject(&DeleteResponseObjectInput{ |
| 3121 | - Service: testServiceID, |
| 3122 | - Version: tv.Number, |
| 3123 | - Name: "new-test-response-object", |
| 3124 | - }) |
| 3125 | - }) |
| 3126 | - if err != nil { |
| 3127 | - t.Fatal(err) |
| 3128 | - } |
| 3129 | } |
| 3130 | |
| 3131 | func TestClient_ListResponseObjects_validation(t *testing.T) { |
| 3132 | Index: golang-github-sethvargo-go-fastly/fastly/s3_test.go |
| 3133 | =================================================================== |
| 3134 | --- golang-github-sethvargo-go-fastly.orig/fastly/s3_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 3135 | +++ golang-github-sethvargo-go-fastly/fastly/s3_test.go 2019-08-22 13:28:33.062639167 +0000 |
| 3136 | @@ -3,195 +3,6 @@ |
| 3137 | import "testing" |
| 3138 | |
| 3139 | func TestClient_S3s(t *testing.T) { |
| 3140 | - t.Parallel() |
| 3141 | - |
| 3142 | - var err error |
| 3143 | - var tv *Version |
| 3144 | - record(t, "s3s/version", func(c *Client) { |
| 3145 | - tv = testVersion(t, c) |
| 3146 | - }) |
| 3147 | - |
| 3148 | - // Create |
| 3149 | - var s3 *S3 |
| 3150 | - record(t, "s3s/create", func(c *Client) { |
| 3151 | - s3, err = c.CreateS3(&CreateS3Input{ |
| 3152 | - Service: testServiceID, |
| 3153 | - Version: tv.Number, |
| 3154 | - Name: "test-s3", |
| 3155 | - BucketName: "bucket-name", |
| 3156 | - Domain: "s3.us-east-1.amazonaws.com", |
| 3157 | - AccessKey: "AKIAIOSFODNN7EXAMPLE", |
| 3158 | - SecretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", |
| 3159 | - Path: "/path", |
| 3160 | - Period: 12, |
| 3161 | - GzipLevel: 9, |
| 3162 | - Format: "format", |
| 3163 | - FormatVersion: 2, |
| 3164 | - TimestampFormat: "%Y", |
| 3165 | - MessageType: "classic", |
| 3166 | - Redundancy: S3RedundancyReduced, |
| 3167 | - Placement: "waf_debug", |
| 3168 | - }) |
| 3169 | - }) |
| 3170 | - if err != nil { |
| 3171 | - t.Fatal(err) |
| 3172 | - } |
| 3173 | - |
| 3174 | - // Ensure deleted |
| 3175 | - defer func() { |
| 3176 | - record(t, "s3s/cleanup", func(c *Client) { |
| 3177 | - c.DeleteS3(&DeleteS3Input{ |
| 3178 | - Service: testServiceID, |
| 3179 | - Version: tv.Number, |
| 3180 | - Name: "test-s3", |
| 3181 | - }) |
| 3182 | - |
| 3183 | - c.DeleteS3(&DeleteS3Input{ |
| 3184 | - Service: testServiceID, |
| 3185 | - Version: tv.Number, |
| 3186 | - Name: "new-test-s3", |
| 3187 | - }) |
| 3188 | - }) |
| 3189 | - }() |
| 3190 | - |
| 3191 | - if s3.Name != "test-s3" { |
| 3192 | - t.Errorf("bad name: %q", s3.Name) |
| 3193 | - } |
| 3194 | - if s3.BucketName != "bucket-name" { |
| 3195 | - t.Errorf("bad bucket_name: %q", s3.BucketName) |
| 3196 | - } |
| 3197 | - if s3.AccessKey != "AKIAIOSFODNN7EXAMPLE" { |
| 3198 | - t.Errorf("bad access_key: %q", s3.AccessKey) |
| 3199 | - } |
| 3200 | - if s3.SecretKey != "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" { |
| 3201 | - t.Errorf("bad secret_key: %q", s3.SecretKey) |
| 3202 | - } |
| 3203 | - if s3.Domain != "s3.us-east-1.amazonaws.com" { |
| 3204 | - t.Errorf("bad domain: %q", s3.Domain) |
| 3205 | - } |
| 3206 | - if s3.Path != "/path" { |
| 3207 | - t.Errorf("bad path: %q", s3.Path) |
| 3208 | - } |
| 3209 | - if s3.Period != 12 { |
| 3210 | - t.Errorf("bad period: %q", s3.Period) |
| 3211 | - } |
| 3212 | - if s3.GzipLevel != 9 { |
| 3213 | - t.Errorf("bad gzip_level: %q", s3.GzipLevel) |
| 3214 | - } |
| 3215 | - if s3.Format != "format" { |
| 3216 | - t.Errorf("bad format: %q", s3.Format) |
| 3217 | - } |
| 3218 | - if s3.FormatVersion != 2 { |
| 3219 | - t.Errorf("bad format_version: %q", s3.FormatVersion) |
| 3220 | - } |
| 3221 | - if s3.TimestampFormat != "%Y" { |
| 3222 | - t.Errorf("bad timestamp_format: %q", s3.TimestampFormat) |
| 3223 | - } |
| 3224 | - if s3.Redundancy != S3RedundancyReduced { |
| 3225 | - t.Errorf("bad redundancy: %q", s3.Redundancy) |
| 3226 | - } |
| 3227 | - if s3.MessageType != "classic" { |
| 3228 | - t.Errorf("bad message_type: %q", s3.MessageType) |
| 3229 | - } |
| 3230 | - if s3.Placement != "waf_debug" { |
| 3231 | - t.Errorf("bad placement: %q", s3.Placement) |
| 3232 | - } |
| 3233 | - |
| 3234 | - // List |
| 3235 | - var s3s []*S3 |
| 3236 | - record(t, "s3s/list", func(c *Client) { |
| 3237 | - s3s, err = c.ListS3s(&ListS3sInput{ |
| 3238 | - Service: testServiceID, |
| 3239 | - Version: tv.Number, |
| 3240 | - }) |
| 3241 | - }) |
| 3242 | - if err != nil { |
| 3243 | - t.Fatal(err) |
| 3244 | - } |
| 3245 | - if len(s3s) < 1 { |
| 3246 | - t.Errorf("bad s3s: %v", s3s) |
| 3247 | - } |
| 3248 | - |
| 3249 | - // Get |
| 3250 | - var ns3 *S3 |
| 3251 | - record(t, "s3s/get", func(c *Client) { |
| 3252 | - ns3, err = c.GetS3(&GetS3Input{ |
| 3253 | - Service: testServiceID, |
| 3254 | - Version: tv.Number, |
| 3255 | - Name: "test-s3", |
| 3256 | - }) |
| 3257 | - }) |
| 3258 | - if err != nil { |
| 3259 | - t.Fatal(err) |
| 3260 | - } |
| 3261 | - if s3.Name != ns3.Name { |
| 3262 | - t.Errorf("bad name: %q", s3.Name) |
| 3263 | - } |
| 3264 | - if s3.BucketName != ns3.BucketName { |
| 3265 | - t.Errorf("bad bucket_name: %q", s3.BucketName) |
| 3266 | - } |
| 3267 | - if s3.AccessKey != ns3.AccessKey { |
| 3268 | - t.Errorf("bad access_key: %q", s3.AccessKey) |
| 3269 | - } |
| 3270 | - if s3.SecretKey != ns3.SecretKey { |
| 3271 | - t.Errorf("bad secret_key: %q", s3.SecretKey) |
| 3272 | - } |
| 3273 | - if s3.Domain != ns3.Domain { |
| 3274 | - t.Errorf("bad domain: %q", s3.Domain) |
| 3275 | - } |
| 3276 | - if s3.Path != ns3.Path { |
| 3277 | - t.Errorf("bad path: %q", s3.Path) |
| 3278 | - } |
| 3279 | - if s3.Period != ns3.Period { |
| 3280 | - t.Errorf("bad period: %q", s3.Period) |
| 3281 | - } |
| 3282 | - if s3.GzipLevel != ns3.GzipLevel { |
| 3283 | - t.Errorf("bad gzip_level: %q", s3.GzipLevel) |
| 3284 | - } |
| 3285 | - if s3.Format != ns3.Format { |
| 3286 | - t.Errorf("bad format: %q", s3.Format) |
| 3287 | - } |
| 3288 | - if s3.FormatVersion != ns3.FormatVersion { |
| 3289 | - t.Errorf("bad format_version: %q", s3.FormatVersion) |
| 3290 | - } |
| 3291 | - if s3.TimestampFormat != ns3.TimestampFormat { |
| 3292 | - t.Errorf("bad timestamp_format: %q", s3.TimestampFormat) |
| 3293 | - } |
| 3294 | - if s3.Redundancy != ns3.Redundancy { |
| 3295 | - t.Errorf("bad redundancy: %q", s3.Redundancy) |
| 3296 | - } |
| 3297 | - if s3.Placement != ns3.Placement { |
| 3298 | - t.Errorf("bad placement: %q", s3.Placement) |
| 3299 | - } |
| 3300 | - |
| 3301 | - // Update |
| 3302 | - var us3 *S3 |
| 3303 | - record(t, "s3s/update", func(c *Client) { |
| 3304 | - us3, err = c.UpdateS3(&UpdateS3Input{ |
| 3305 | - Service: testServiceID, |
| 3306 | - Version: tv.Number, |
| 3307 | - Name: "test-s3", |
| 3308 | - NewName: "new-test-s3", |
| 3309 | - }) |
| 3310 | - }) |
| 3311 | - if err != nil { |
| 3312 | - t.Fatal(err) |
| 3313 | - } |
| 3314 | - if us3.Name != "new-test-s3" { |
| 3315 | - t.Errorf("bad name: %q", us3.Name) |
| 3316 | - } |
| 3317 | - |
| 3318 | - // Delete |
| 3319 | - record(t, "s3s/delete", func(c *Client) { |
| 3320 | - err = c.DeleteS3(&DeleteS3Input{ |
| 3321 | - Service: testServiceID, |
| 3322 | - Version: tv.Number, |
| 3323 | - Name: "new-test-s3", |
| 3324 | - }) |
| 3325 | - }) |
| 3326 | - if err != nil { |
| 3327 | - t.Fatal(err) |
| 3328 | - } |
| 3329 | } |
| 3330 | |
| 3331 | func TestClient_ListS3s_validation(t *testing.T) { |
| 3332 | Index: golang-github-sethvargo-go-fastly/fastly/settings_test.go |
| 3333 | =================================================================== |
| 3334 | --- golang-github-sethvargo-go-fastly.orig/fastly/settings_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 3335 | +++ golang-github-sethvargo-go-fastly/fastly/settings_test.go 2019-08-22 13:27:58.813116214 +0000 |
| 3336 | @@ -8,52 +8,6 @@ |
| 3337 | ) |
| 3338 | |
| 3339 | func TestClient_Settings(t *testing.T) { |
| 3340 | - t.Parallel() |
| 3341 | - |
| 3342 | - var err error |
| 3343 | - var tv *Version |
| 3344 | - record(t, "settings/version", func(c *Client) { |
| 3345 | - tv = testVersion(t, c) |
| 3346 | - }) |
| 3347 | - |
| 3348 | - // Get |
| 3349 | - var ns *Settings |
| 3350 | - record(t, "settings/get", func(c *Client) { |
| 3351 | - ns, err = c.GetSettings(&GetSettingsInput{ |
| 3352 | - Service: testServiceID, |
| 3353 | - Version: tv.Number, |
| 3354 | - }) |
| 3355 | - }) |
| 3356 | - if err != nil { |
| 3357 | - t.Fatal(err) |
| 3358 | - } |
| 3359 | - if ns.DefaultTTL == 0 { |
| 3360 | - t.Errorf("bad default_ttl: %d", ns.DefaultTTL) |
| 3361 | - } |
| 3362 | - |
| 3363 | - // Update |
| 3364 | - var us *Settings |
| 3365 | - record(t, "settings/update", func(c *Client) { |
| 3366 | - us, err = c.UpdateSettings(&UpdateSettingsInput{ |
| 3367 | - Service: testServiceID, |
| 3368 | - Version: tv.Number, |
| 3369 | - DefaultTTL: 1800, |
| 3370 | - StaleIfError: true, |
| 3371 | - StaleIfErrorTTL: 57600, |
| 3372 | - }) |
| 3373 | - }) |
| 3374 | - if err != nil { |
| 3375 | - t.Fatal(err) |
| 3376 | - } |
| 3377 | - if us.DefaultTTL != 1800 { |
| 3378 | - t.Errorf("bad default_ttl: %d", us.DefaultTTL) |
| 3379 | - } |
| 3380 | - if us.StaleIfError != true { |
| 3381 | - t.Errorf("bad stale_if_error: %t", us.StaleIfError) |
| 3382 | - } |
| 3383 | - if us.StaleIfErrorTTL != 57600 { |
| 3384 | - t.Errorf("bad stale_if_error_ttl %d", us.StaleIfErrorTTL) |
| 3385 | - } |
| 3386 | } |
| 3387 | |
| 3388 | // Tests if we can update a default_ttl to 0 as reported in issue #20 |
| 3389 | Index: golang-github-sethvargo-go-fastly/fastly/splunk_test.go |
| 3390 | =================================================================== |
| 3391 | --- golang-github-sethvargo-go-fastly.orig/fastly/splunk_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 3392 | +++ golang-github-sethvargo-go-fastly/fastly/splunk_test.go 2019-08-22 13:27:18.451321477 +0000 |
| 3393 | @@ -3,142 +3,6 @@ |
| 3394 | import "testing" |
| 3395 | |
| 3396 | func TestClient_Splunks(t *testing.T) { |
| 3397 | - t.Parallel() |
| 3398 | - |
| 3399 | - var err error |
| 3400 | - var tv *Version |
| 3401 | - record(t, "splunks/version", func(c *Client) { |
| 3402 | - tv = testVersion(t, c) |
| 3403 | - }) |
| 3404 | - |
| 3405 | - // Create |
| 3406 | - var s *Splunk |
| 3407 | - record(t, "splunks/create", func(c *Client) { |
| 3408 | - s, err = c.CreateSplunk(&CreateSplunkInput{ |
| 3409 | - Service: testServiceID, |
| 3410 | - Version: tv.Number, |
| 3411 | - Name: "test-splunk", |
| 3412 | - URL: "https://mysplunkendpoint.example.com/services/collector/event", |
| 3413 | - Format: "%h %l %u %t \"%r\" %>s %b", |
| 3414 | - FormatVersion: 2, |
| 3415 | - Placement: "waf_debug", |
| 3416 | - Token: "super-secure-token", |
| 3417 | - }) |
| 3418 | - }) |
| 3419 | - if err != nil { |
| 3420 | - t.Fatal(err) |
| 3421 | - } |
| 3422 | - |
| 3423 | - // Ensure deleted |
| 3424 | - defer func() { |
| 3425 | - record(t, "splunks/cleanup", func(c *Client) { |
| 3426 | - c.DeleteSplunk(&DeleteSplunkInput{ |
| 3427 | - Service: testServiceID, |
| 3428 | - Version: tv.Number, |
| 3429 | - Name: "test-splunk", |
| 3430 | - }) |
| 3431 | - |
| 3432 | - c.DeleteSplunk(&DeleteSplunkInput{ |
| 3433 | - Service: testServiceID, |
| 3434 | - Version: tv.Number, |
| 3435 | - Name: "new-test-splunk", |
| 3436 | - }) |
| 3437 | - }) |
| 3438 | - }() |
| 3439 | - |
| 3440 | - if s.Name != "test-splunk" { |
| 3441 | - t.Errorf("bad name: %q", s.Name) |
| 3442 | - } |
| 3443 | - if s.URL != "https://mysplunkendpoint.example.com/services/collector/event" { |
| 3444 | - t.Errorf("bad url: %q", s.URL) |
| 3445 | - } |
| 3446 | - if s.Format != "%h %l %u %t \"%r\" %>s %b" { |
| 3447 | - t.Errorf("bad format: %q", s.Format) |
| 3448 | - } |
| 3449 | - if s.FormatVersion != 2 { |
| 3450 | - t.Errorf("bad format_version: %q", s.FormatVersion) |
| 3451 | - } |
| 3452 | - if s.Placement != "waf_debug" { |
| 3453 | - t.Errorf("bad placement: %q", s.Placement) |
| 3454 | - } |
| 3455 | - if s.Token != "super-secure-token" { |
| 3456 | - t.Errorf("bad token: %q", s.Token) |
| 3457 | - } |
| 3458 | - |
| 3459 | - // List |
| 3460 | - var ss []*Splunk |
| 3461 | - record(t, "splunks/list", func(c *Client) { |
| 3462 | - ss, err = c.ListSplunks(&ListSplunksInput{ |
| 3463 | - Service: testServiceID, |
| 3464 | - Version: tv.Number, |
| 3465 | - }) |
| 3466 | - }) |
| 3467 | - if err != nil { |
| 3468 | - t.Fatal(err) |
| 3469 | - } |
| 3470 | - if len(ss) < 1 { |
| 3471 | - t.Errorf("bad splunks: %v", ss) |
| 3472 | - } |
| 3473 | - |
| 3474 | - // Get |
| 3475 | - var ns *Splunk |
| 3476 | - record(t, "splunks/get", func(c *Client) { |
| 3477 | - ns, err = c.GetSplunk(&GetSplunkInput{ |
| 3478 | - Service: testServiceID, |
| 3479 | - Version: tv.Number, |
| 3480 | - Name: "test-splunk", |
| 3481 | - }) |
| 3482 | - }) |
| 3483 | - if err != nil { |
| 3484 | - t.Fatal(err) |
| 3485 | - } |
| 3486 | - if s.Name != ns.Name { |
| 3487 | - t.Errorf("bad name: %q", s.Name) |
| 3488 | - } |
| 3489 | - if s.URL != ns.URL { |
| 3490 | - t.Errorf("bad url: %q", s.URL) |
| 3491 | - } |
| 3492 | - if s.Format != ns.Format { |
| 3493 | - t.Errorf("bad format: %q", s.Format) |
| 3494 | - } |
| 3495 | - if s.FormatVersion != ns.FormatVersion { |
| 3496 | - t.Errorf("bad format_version: %q", s.FormatVersion) |
| 3497 | - } |
| 3498 | - if s.Placement != ns.Placement { |
| 3499 | - t.Errorf("bad placement: %q", s.Placement) |
| 3500 | - } |
| 3501 | - if s.Token != ns.Token { |
| 3502 | - t.Errorf("bad token: %q", s.Token) |
| 3503 | - } |
| 3504 | - |
| 3505 | - // Update |
| 3506 | - var us *Splunk |
| 3507 | - record(t, "splunks/update", func(c *Client) { |
| 3508 | - us, err = c.UpdateSplunk(&UpdateSplunkInput{ |
| 3509 | - Service: testServiceID, |
| 3510 | - Version: tv.Number, |
| 3511 | - Name: "test-splunk", |
| 3512 | - NewName: "new-test-splunk", |
| 3513 | - }) |
| 3514 | - }) |
| 3515 | - if err != nil { |
| 3516 | - t.Fatal(err) |
| 3517 | - } |
| 3518 | - if us.Name != "new-test-splunk" { |
| 3519 | - t.Errorf("bad name: %q", us.Name) |
| 3520 | - } |
| 3521 | - |
| 3522 | - // Delete |
| 3523 | - record(t, "splunks/delete", func(c *Client) { |
| 3524 | - err = c.DeleteSplunk(&DeleteSplunkInput{ |
| 3525 | - Service: testServiceID, |
| 3526 | - Version: tv.Number, |
| 3527 | - Name: "new-test-splunk", |
| 3528 | - }) |
| 3529 | - }) |
| 3530 | - if err != nil { |
| 3531 | - t.Fatal(err) |
| 3532 | - } |
| 3533 | } |
| 3534 | |
| 3535 | func TestClient_ListSplunks_validation(t *testing.T) { |
| 3536 | Index: golang-github-sethvargo-go-fastly/fastly/blobstorage_test.go |
| 3537 | =================================================================== |
| 3538 | --- golang-github-sethvargo-go-fastly.orig/fastly/blobstorage_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 3539 | +++ golang-github-sethvargo-go-fastly/fastly/blobstorage_test.go 2019-08-22 13:44:38.461566976 +0000 |
| 3540 | @@ -3,191 +3,6 @@ |
| 3541 | import "testing" |
| 3542 | |
| 3543 | func TestClient_BlobStorages(t *testing.T) { |
| 3544 | - t.Parallel() |
| 3545 | - |
| 3546 | - var err error |
| 3547 | - var tv *Version |
| 3548 | - record(t, "blobstorages/version", func(c *Client) { |
| 3549 | - tv = testVersion(t, c) |
| 3550 | - }) |
| 3551 | - |
| 3552 | - // Create |
| 3553 | - var bs *BlobStorage |
| 3554 | - record(t, "blobstorages/create", func(c *Client) { |
| 3555 | - bs, err = c.CreateBlobStorage(&CreateBlobStorageInput{ |
| 3556 | - Service: testServiceID, |
| 3557 | - Version: tv.Number, |
| 3558 | - Name: "test-blobstorage", |
| 3559 | - Path: "/logs", |
| 3560 | - AccountName: "test", |
| 3561 | - Container: "fastly", |
| 3562 | - SASToken: "sv=2015-04-05&ss=b&srt=sco&sp=rw&se=2019-07-21T18%3A00%3A00Z&sig=3ABdLOJZosCp0o491T%2BqZGKIhafF1nlM3MzESDDD3Gg%3D", |
| 3563 | - Period: 12, |
| 3564 | - TimestampFormat: "%Y-%m-%dT%H:%M:%S.000", |
| 3565 | - GzipLevel: 9, |
| 3566 | - PublicKey: "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQENBFyUD8sBCACyFnB39AuuTygseek+eA4fo0cgwva6/FSjnWq7riouQee8GgQ/\nibXTRyv4iVlwI12GswvMTIy7zNvs1R54i0qvsLr+IZ4GVGJqs6ZJnvQcqe3xPoR4\n8AnBfw90o32r/LuHf6QCJXi+AEu35koNlNAvLJ2B+KACaNB7N0EeWmqpV/1V2k9p\nlDYk+th7LcCuaFNGqKS/PrMnnMqR6VDLCjHhNx4KR79b0Twm/2qp6an3hyNRu8Gn\ndwxpf1/BUu3JWf+LqkN4Y3mbOmSUL3MaJNvyQguUzTfS0P0uGuBDHrJCVkMZCzDB\n89ag55jCPHyGeHBTd02gHMWzsg3WMBWvCsrzABEBAAG0JXRlcnJhZm9ybSAodGVz\ndCkgPHRlc3RAdGVycmFmb3JtLmNvbT6JAU4EEwEIADgWIQSHYyc6Kj9l6HzQsau6\nvFFc9jxV/wUCXJQPywIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRC6vFFc\n9jxV/815CAClb32OxV7wG01yF97TzlyTl8TnvjMtoG29Mw4nSyg+mjM3b8N7iXm9\nOLX59fbDAWtBSldSZE22RXd3CvlFOG/EnKBXSjBtEqfyxYSnyOPkMPBYWGL/ApkX\nSvPYJ4LKdvipYToKFh3y9kk2gk1DcDBDyaaHvR+3rv1u3aoy7/s2EltAfDS3ZQIq\n7/cWTLJml/lleeB/Y6rPj8xqeCYhE5ahw9gsV/Mdqatl24V9Tks30iijx0Hhw+Gx\nkATUikMGr2GDVqoIRga5kXI7CzYff4rkc0Twn47fMHHHe/KY9M2yVnMHUXmAZwbG\nM1cMI/NH1DjevCKdGBLcRJlhuLPKF/anuQENBFyUD8sBCADIpd7r7GuPd6n/Ikxe\nu6h7umV6IIPoAm88xCYpTbSZiaK30Svh6Ywra9jfE2KlU9o6Y/art8ip0VJ3m07L\n4RSfSpnzqgSwdjSq5hNour2Fo/BzYhK7yaz2AzVSbe33R0+RYhb4b/6N+bKbjwGF\nftCsqVFMH+PyvYkLbvxyQrHlA9woAZaNThI1ztO5rGSnGUR8xt84eup28WIFKg0K\nUEGUcTzz+8QGAwAra+0ewPXo/AkO+8BvZjDidP417u6gpBHOJ9qYIcO9FxHeqFyu\nYrjlrxowEgXn5wO8xuNz6Vu1vhHGDHGDsRbZF8pv1d5O+0F1G7ttZ2GRRgVBZPwi\nkiyRABEBAAGJATYEGAEIACAWIQSHYyc6Kj9l6HzQsau6vFFc9jxV/wUCXJQPywIb\nDAAKCRC6vFFc9jxV/9YOCACe8qmOSnKQpQfW+PqYOqo3dt7JyweTs3FkD6NT8Zml\ndYy/vkstbTjPpX6aTvUZjkb46BVi7AOneVHpD5GBqvRsZ9iVgDYHaehmLCdKiG5L\n3Tp90NN+QY5WDbsGmsyk6+6ZMYejb4qYfweQeduOj27aavCJdLkCYMoRKfcFYI8c\nFaNmEfKKy/r1PO20NXEG6t9t05K/frHy6ZG8bCNYdpagfFVot47r9JaQqWlTNtIR\n5+zkkSq/eG9BEtRij3a6cTdQbktdBzx2KBeI0PYc1vlZR0LpuFKZqY9vlE6vTGLR\nwMfrTEOvx0NxUM3rpaCgEmuWbB1G1Hu371oyr4srrr+N\n=28dr\n-----END PGP PUBLIC KEY BLOCK-----\n", |
| 3567 | - Format: "%h %l %u %{now}V %{req.method}V %{req.url}V %>s %{resp.http.Content-Length}V", |
| 3568 | - FormatVersion: 2, |
| 3569 | - MessageType: "classic", |
| 3570 | - Placement: "waf_debug", |
| 3571 | - }) |
| 3572 | - }) |
| 3573 | - if err != nil { |
| 3574 | - t.Fatal(err) |
| 3575 | - } |
| 3576 | - |
| 3577 | - // Ensure deleted |
| 3578 | - defer func() { |
| 3579 | - record(t, "blobstorages/cleanup", func(c *Client) { |
| 3580 | - c.DeleteBlobStorage(&DeleteBlobStorageInput{ |
| 3581 | - Service: testServiceID, |
| 3582 | - Version: tv.Number, |
| 3583 | - Name: "test-blobstorage", |
| 3584 | - }) |
| 3585 | - |
| 3586 | - c.DeleteBlobStorage(&DeleteBlobStorageInput{ |
| 3587 | - Service: testServiceID, |
| 3588 | - Version: tv.Number, |
| 3589 | - Name: "new-test-blobstorage", |
| 3590 | - }) |
| 3591 | - }) |
| 3592 | - }() |
| 3593 | - |
| 3594 | - if bs.Name != "test-blobstorage" { |
| 3595 | - t.Errorf("bad name: %q", bs.Name) |
| 3596 | - } |
| 3597 | - if bs.Path != "/logs" { |
| 3598 | - t.Errorf("bad path: %q", bs.Path) |
| 3599 | - } |
| 3600 | - if bs.AccountName != "test" { |
| 3601 | - t.Errorf("bad account_name: %q", bs.AccountName) |
| 3602 | - } |
| 3603 | - if bs.Container != "fastly" { |
| 3604 | - t.Errorf("bad container: %q", bs.Container) |
| 3605 | - } |
| 3606 | - if bs.SASToken != "sv=2015-04-05&ss=b&srt=sco&sp=rw&se=2019-07-21T18%3A00%3A00Z&sig=3ABdLOJZosCp0o491T%2BqZGKIhafF1nlM3MzESDDD3Gg%3D" { |
| 3607 | - t.Errorf("bad sas_token: %q", bs.SASToken) |
| 3608 | - } |
| 3609 | - if bs.Period != 12 { |
| 3610 | - t.Errorf("bad period: %q", bs.Period) |
| 3611 | - } |
| 3612 | - if bs.TimestampFormat != "%Y-%m-%dT%H:%M:%S.000" { |
| 3613 | - t.Errorf("bad timestamp_format: %q", bs.TimestampFormat) |
| 3614 | - } |
| 3615 | - if bs.GzipLevel != 9 { |
| 3616 | - t.Errorf("bad gzip_level: %q", bs.GzipLevel) |
| 3617 | - } |
| 3618 | - if bs.PublicKey != "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQENBFyUD8sBCACyFnB39AuuTygseek+eA4fo0cgwva6/FSjnWq7riouQee8GgQ/\nibXTRyv4iVlwI12GswvMTIy7zNvs1R54i0qvsLr+IZ4GVGJqs6ZJnvQcqe3xPoR4\n8AnBfw90o32r/LuHf6QCJXi+AEu35koNlNAvLJ2B+KACaNB7N0EeWmqpV/1V2k9p\nlDYk+th7LcCuaFNGqKS/PrMnnMqR6VDLCjHhNx4KR79b0Twm/2qp6an3hyNRu8Gn\ndwxpf1/BUu3JWf+LqkN4Y3mbOmSUL3MaJNvyQguUzTfS0P0uGuBDHrJCVkMZCzDB\n89ag55jCPHyGeHBTd02gHMWzsg3WMBWvCsrzABEBAAG0JXRlcnJhZm9ybSAodGVz\ndCkgPHRlc3RAdGVycmFmb3JtLmNvbT6JAU4EEwEIADgWIQSHYyc6Kj9l6HzQsau6\nvFFc9jxV/wUCXJQPywIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRC6vFFc\n9jxV/815CAClb32OxV7wG01yF97TzlyTl8TnvjMtoG29Mw4nSyg+mjM3b8N7iXm9\nOLX59fbDAWtBSldSZE22RXd3CvlFOG/EnKBXSjBtEqfyxYSnyOPkMPBYWGL/ApkX\nSvPYJ4LKdvipYToKFh3y9kk2gk1DcDBDyaaHvR+3rv1u3aoy7/s2EltAfDS3ZQIq\n7/cWTLJml/lleeB/Y6rPj8xqeCYhE5ahw9gsV/Mdqatl24V9Tks30iijx0Hhw+Gx\nkATUikMGr2GDVqoIRga5kXI7CzYff4rkc0Twn47fMHHHe/KY9M2yVnMHUXmAZwbG\nM1cMI/NH1DjevCKdGBLcRJlhuLPKF/anuQENBFyUD8sBCADIpd7r7GuPd6n/Ikxe\nu6h7umV6IIPoAm88xCYpTbSZiaK30Svh6Ywra9jfE2KlU9o6Y/art8ip0VJ3m07L\n4RSfSpnzqgSwdjSq5hNour2Fo/BzYhK7yaz2AzVSbe33R0+RYhb4b/6N+bKbjwGF\nftCsqVFMH+PyvYkLbvxyQrHlA9woAZaNThI1ztO5rGSnGUR8xt84eup28WIFKg0K\nUEGUcTzz+8QGAwAra+0ewPXo/AkO+8BvZjDidP417u6gpBHOJ9qYIcO9FxHeqFyu\nYrjlrxowEgXn5wO8xuNz6Vu1vhHGDHGDsRbZF8pv1d5O+0F1G7ttZ2GRRgVBZPwi\nkiyRABEBAAGJATYEGAEIACAWIQSHYyc6Kj9l6HzQsau6vFFc9jxV/wUCXJQPywIb\nDAAKCRC6vFFc9jxV/9YOCACe8qmOSnKQpQfW+PqYOqo3dt7JyweTs3FkD6NT8Zml\ndYy/vkstbTjPpX6aTvUZjkb46BVi7AOneVHpD5GBqvRsZ9iVgDYHaehmLCdKiG5L\n3Tp90NN+QY5WDbsGmsyk6+6ZMYejb4qYfweQeduOj27aavCJdLkCYMoRKfcFYI8c\nFaNmEfKKy/r1PO20NXEG6t9t05K/frHy6ZG8bCNYdpagfFVot47r9JaQqWlTNtIR\n5+zkkSq/eG9BEtRij3a6cTdQbktdBzx2KBeI0PYc1vlZR0LpuFKZqY9vlE6vTGLR\nwMfrTEOvx0NxUM3rpaCgEmuWbB1G1Hu371oyr4srrr+N\n=28dr\n-----END PGP PUBLIC KEY BLOCK-----\n" { |
| 3619 | - t.Errorf("bad public_key: %q", bs.PublicKey) |
| 3620 | - } |
| 3621 | - if bs.Format != "%h %l %u %{now}V %{req.method}V %{req.url}V %>s %{resp.http.Content-Length}V" { |
| 3622 | - t.Errorf("bad format: %q", bs.Format) |
| 3623 | - } |
| 3624 | - if bs.FormatVersion != 2 { |
| 3625 | - t.Errorf("bad format_version: %q", bs.FormatVersion) |
| 3626 | - } |
| 3627 | - if bs.MessageType != "classic" { |
| 3628 | - t.Errorf("bad message_type: %q", bs.MessageType) |
| 3629 | - } |
| 3630 | - if bs.Placement != "waf_debug" { |
| 3631 | - t.Errorf("bad placement: %q", bs.Placement) |
| 3632 | - } |
| 3633 | - |
| 3634 | - // List |
| 3635 | - var bsl []*BlobStorage |
| 3636 | - record(t, "blobstorages/list", func(c *Client) { |
| 3637 | - bsl, err = c.ListBlobStorages(&ListBlobStoragesInput{ |
| 3638 | - Service: testServiceID, |
| 3639 | - Version: tv.Number, |
| 3640 | - }) |
| 3641 | - }) |
| 3642 | - if err != nil { |
| 3643 | - t.Fatal(err) |
| 3644 | - } |
| 3645 | - if len(bsl) < 1 { |
| 3646 | - t.Errorf("bad blob storages: %v", bsl) |
| 3647 | - } |
| 3648 | - |
| 3649 | - // Get |
| 3650 | - var nbs *BlobStorage |
| 3651 | - record(t, "blobstorages/get", func(c *Client) { |
| 3652 | - nbs, err = c.GetBlobStorage(&GetBlobStorageInput{ |
| 3653 | - Service: testServiceID, |
| 3654 | - Version: tv.Number, |
| 3655 | - Name: "test-blobstorage", |
| 3656 | - }) |
| 3657 | - }) |
| 3658 | - if err != nil { |
| 3659 | - t.Fatal(err) |
| 3660 | - } |
| 3661 | - if bs.Name != nbs.Name { |
| 3662 | - t.Errorf("bad name: %q", bs.Name) |
| 3663 | - } |
| 3664 | - if bs.Path != nbs.Path { |
| 3665 | - t.Errorf("bad path: %q", bs.Path) |
| 3666 | - } |
| 3667 | - if bs.AccountName != nbs.AccountName { |
| 3668 | - t.Errorf("bad account_name: %q", bs.AccountName) |
| 3669 | - } |
| 3670 | - if bs.Container != nbs.Container { |
| 3671 | - t.Errorf("bad container: %q", bs.Container) |
| 3672 | - } |
| 3673 | - if bs.SASToken != nbs.SASToken { |
| 3674 | - t.Errorf("bad sas_token: %q", bs.SASToken) |
| 3675 | - } |
| 3676 | - if bs.Period != nbs.Period { |
| 3677 | - t.Errorf("bad period: %q", bs.Period) |
| 3678 | - } |
| 3679 | - if bs.TimestampFormat != nbs.TimestampFormat { |
| 3680 | - t.Errorf("bad timestamp_format: %q", bs.TimestampFormat) |
| 3681 | - } |
| 3682 | - if bs.GzipLevel != nbs.GzipLevel { |
| 3683 | - t.Errorf("bad gzip_level: %q", bs.GzipLevel) |
| 3684 | - } |
| 3685 | - if bs.PublicKey != nbs.PublicKey { |
| 3686 | - t.Errorf("bad public_key: %q", bs.PublicKey) |
| 3687 | - } |
| 3688 | - if bs.Format != nbs.Format { |
| 3689 | - t.Errorf("bad format: %q", bs.Format) |
| 3690 | - } |
| 3691 | - if bs.FormatVersion != nbs.FormatVersion { |
| 3692 | - t.Errorf("bad format_version: %q", bs.FormatVersion) |
| 3693 | - } |
| 3694 | - if bs.MessageType != nbs.MessageType { |
| 3695 | - t.Errorf("bad message_type: %q", bs.MessageType) |
| 3696 | - } |
| 3697 | - if bs.Placement != nbs.Placement { |
| 3698 | - t.Errorf("bad placement: %q", bs.Placement) |
| 3699 | - } |
| 3700 | - |
| 3701 | - // Update |
| 3702 | - var ubs *BlobStorage |
| 3703 | - record(t, "blobstorages/update", func(c *Client) { |
| 3704 | - ubs, err = c.UpdateBlobStorage(&UpdateBlobStorageInput{ |
| 3705 | - Service: testServiceID, |
| 3706 | - Version: tv.Number, |
| 3707 | - Name: "test-blobstorage", |
| 3708 | - NewName: "new-test-blobstorage", |
| 3709 | - }) |
| 3710 | - }) |
| 3711 | - if err != nil { |
| 3712 | - t.Fatal(err) |
| 3713 | - } |
| 3714 | - if ubs.Name != "new-test-blobstorage" { |
| 3715 | - t.Errorf("bad name: %q", ubs.Name) |
| 3716 | - } |
| 3717 | - |
| 3718 | - // Delete |
| 3719 | - record(t, "blobstorages/delete", func(c *Client) { |
| 3720 | - err = c.DeleteBlobStorage(&DeleteBlobStorageInput{ |
| 3721 | - Service: testServiceID, |
| 3722 | - Version: tv.Number, |
| 3723 | - Name: "new-test-blobstorage", |
| 3724 | - }) |
| 3725 | - }) |
| 3726 | - if err != nil { |
| 3727 | - t.Fatal(err) |
| 3728 | - } |
| 3729 | } |
| 3730 | |
| 3731 | func TestClient_ListBlobStorages_validation(t *testing.T) { |
| 3732 | Index: golang-github-sethvargo-go-fastly/fastly/event_logs_test.go |
| 3733 | =================================================================== |
| 3734 | --- golang-github-sethvargo-go-fastly.orig/fastly/event_logs_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 3735 | +++ golang-github-sethvargo-go-fastly/fastly/event_logs_test.go 2019-08-22 13:48:29.503840593 +0000 |
| 3736 | @@ -9,36 +9,6 @@ |
| 3737 | var testEventID = "3OMewexIMbzrQj77xxxxxx" |
| 3738 | |
| 3739 | func TestClient_APIEvents(t *testing.T) { |
| 3740 | - t.Parallel() |
| 3741 | - |
| 3742 | - var err error |
| 3743 | - var events GetAPIEventsResponse |
| 3744 | - record(t, "events/get_events", func(c *Client) { |
| 3745 | - events, err = c.GetAPIEvents(&GetAPIEventsFilterInput{ |
| 3746 | - PageNumber: 1, |
| 3747 | - MaxResults: 1, |
| 3748 | - }) |
| 3749 | - }) |
| 3750 | - if err != nil { |
| 3751 | - t.Fatal(err) |
| 3752 | - } |
| 3753 | - if len(events.Events) < 1 { |
| 3754 | - t.Errorf("bad events: %v", events.Events) |
| 3755 | - } |
| 3756 | - |
| 3757 | - var event *Event |
| 3758 | - record(t, "events/get_event", func(c *Client) { |
| 3759 | - event, err = c.GetAPIEvent(&GetAPIEventInput{ |
| 3760 | - EventID: events.Events[0].ID, |
| 3761 | - }) |
| 3762 | - }) |
| 3763 | - if err != nil { |
| 3764 | - t.Fatal(err) |
| 3765 | - } |
| 3766 | - if len(event.ID) < 1 { |
| 3767 | - t.Errorf("bad event: %v", event) |
| 3768 | - } |
| 3769 | - |
| 3770 | } |
| 3771 | |
| 3772 | func TestClient_GetAPIEvent_validation(t *testing.T) { |
| 3773 | Index: golang-github-sethvargo-go-fastly/fastly/gcs_test.go |
| 3774 | =================================================================== |
| 3775 | --- golang-github-sethvargo-go-fastly.orig/fastly/gcs_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 3776 | +++ golang-github-sethvargo-go-fastly/fastly/gcs_test.go 2019-08-22 13:49:09.373613459 +0000 |
| 3777 | @@ -3,184 +3,6 @@ |
| 3778 | import "testing" |
| 3779 | |
| 3780 | func TestClient_GCSs(t *testing.T) { |
| 3781 | - t.Parallel() |
| 3782 | - |
| 3783 | - var err error |
| 3784 | - var tv *Version |
| 3785 | - record(t, "gcses/version", func(c *Client) { |
| 3786 | - tv = testVersion(t, c) |
| 3787 | - }) |
| 3788 | - |
| 3789 | - // Create |
| 3790 | - var gcs *GCS |
| 3791 | - record(t, "gcses/create", func(c *Client) { |
| 3792 | - gcs, err = c.CreateGCS(&CreateGCSInput{ |
| 3793 | - Service: testServiceID, |
| 3794 | - Version: tv.Number, |
| 3795 | - Name: "test-gcs", |
| 3796 | - Bucket: "bucket", |
| 3797 | - User: "user", |
| 3798 | - SecretKey: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC9aQoqdHVA86oq\nTdRQ5HqwMfpiLBBMKNQcAJsO71RKNrDWwJJZiyYbvM4FOWRZFtRSdPIDgX0C0Wg1\nNnqWYvHDyA5Ug+T8kowiQDn56dU6Km2FWO4wnqZeA8q5G7rQVXlqdibuiP7FglHA\neURUzFsqyymXMUGrqDPqrHsVWC2E3NTJEb4QlywtrwI13qbhlvTx6/9oRfUjytXJ\nRuUIE5xL8yhRCagNr5ZW250aa+wBwu5DSCk5fDNr0eDuZjw84WHDll+mHxBFGV+X\nKJ5jCOmGumGqjVWZesJpNN1My3M9bsY9layNJJ0eiDeHDEi/yXhhO/mNEXhvhq/R\nfN0Jh2A3AgMBAAECggEAef+CEL5aF6/aVs0yh7fiXkKSp1ECXkud8ztgpEn63KJF\nXM1EdnBt50fA2xSQUeGmeEXi6+cngf0nRb8FToAEgLoGoOEjSJuLrzP3I8U9Fe3m\nBRG2uZI2Ti/bD0eRGEc1oSDhCpsqnkTGK1bwcD4AKpwY+c08Izh/2BOoY6McDoqh\ndQ89jzTuMtD4cNlnPiIrY9HbxoNjshK2ax1OaeXyYKZFG1TxqMFv5gA/G5+S3Cwr\nVG4fkAxYi5vdIK3b8jUXrTM/kpoTl+d3dlQ7rRZYf7KyT31/HtJ/GNzxFI6upzO7\niDNrrUOyeOPjWXdzUh9budv3j+6UfbYK7uZIoebHIQKBgQDykYX1L/akGaOC2tfS\njzCWUzPxGFYVZQ7zD1PM6UyouuS1KLURDEGk9RxqVzTPh/pYd8Ivnz3vOVski5Zt\n19ozLGxdtDhn122DcnVpfCdYzHBdAzPCzORenFohX+MhiX5fEotTlVi7wfOmzTP5\nhUCMSd/17bJrV4XMLhkdrMRBFQKBgQDH5fwV7o+Ej/ZfcdGIa3mAFazToPDzxhHU\nnwADxaxpNGKRU03XCaiYkykarLYdG6Rk+7dXUv8eLy+6Dcq1SWQtfCWKEor++IIp\n1RwWmFHfYriHGkmxSkkEkLFvL8old9xM5YWbEXc4QIXvnfR4BZxdyJHVzIDdbI2i\nFgcn17U3GwKBgDd1njMY7ENIuWHJt16k7m7wRwfwkH4DxQ89ieNn0+cgE/p3fC6R\nptCYWg7WMXThmhNwDi3lMrvnWTdZ0uL6XyEkHwKtmdfkIV3UZZPglv5uf6JEgSkg\nv3YCOXk3+y5HyWTjUIejtc334kVY1XFPThrFKTeJSSnRsP2l7IgkYBqhAoGAYGsr\nM3z1FrDF2nWw5odIfKJ30UAw2LRyB0eGH0uqhLgyzvwKcK2E98sLqYUi9llN6zOK\n1IEA8xM5hxl97AFxY4sdJEMbbi55wim7uZ5Q51nbvbbNUsmM/Lm6C/JWI8pzpVeU\nIR7EjYp50AE1WOsD6CyFQ0W35pWkn0jWvL4L938CgYEAlax4dLE5+YCG5DeLT1/N\nin6kQjl7JS4oCNlPEj6aRPLX2OJresI7oOn+uNatKvlVyfPm6rdxeHCmER1FpR7Q\nA/aNVjPeViKT/R4nK9ytsa+s/1IJVrwLFHJK3toGE660g5w3vKrCjWisMdP4yzzQ\nbv1KwcKoQbNVXwauH79JKc0=\n-----END PRIVATE KEY-----\n", |
| 3799 | - Path: "/path", |
| 3800 | - Period: 12, |
| 3801 | - GzipLevel: 9, |
| 3802 | - FormatVersion: 2, |
| 3803 | - Format: "format", |
| 3804 | - MessageType: "blank", |
| 3805 | - TimestampFormat: "%Y", |
| 3806 | - Placement: "waf_debug", |
| 3807 | - }) |
| 3808 | - }) |
| 3809 | - if err != nil { |
| 3810 | - t.Fatal(err) |
| 3811 | - } |
| 3812 | - |
| 3813 | - // Ensure deleted |
| 3814 | - defer func() { |
| 3815 | - record(t, "gcses/cleanup", func(c *Client) { |
| 3816 | - c.DeleteGCS(&DeleteGCSInput{ |
| 3817 | - Service: testServiceID, |
| 3818 | - Version: tv.Number, |
| 3819 | - Name: "test-gcs", |
| 3820 | - }) |
| 3821 | - |
| 3822 | - c.DeleteGCS(&DeleteGCSInput{ |
| 3823 | - Service: testServiceID, |
| 3824 | - Version: tv.Number, |
| 3825 | - Name: "new-test-gcs", |
| 3826 | - }) |
| 3827 | - }) |
| 3828 | - }() |
| 3829 | - |
| 3830 | - if gcs.Name != "test-gcs" { |
| 3831 | - t.Errorf("bad name: %q", gcs.Name) |
| 3832 | - } |
| 3833 | - if gcs.Bucket != "bucket" { |
| 3834 | - t.Errorf("bad bucket: %q", gcs.Bucket) |
| 3835 | - } |
| 3836 | - if gcs.User != "user" { |
| 3837 | - t.Errorf("bad user: %q", gcs.User) |
| 3838 | - } |
| 3839 | - if gcs.SecretKey != "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC9aQoqdHVA86oq\nTdRQ5HqwMfpiLBBMKNQcAJsO71RKNrDWwJJZiyYbvM4FOWRZFtRSdPIDgX0C0Wg1\nNnqWYvHDyA5Ug+T8kowiQDn56dU6Km2FWO4wnqZeA8q5G7rQVXlqdibuiP7FglHA\neURUzFsqyymXMUGrqDPqrHsVWC2E3NTJEb4QlywtrwI13qbhlvTx6/9oRfUjytXJ\nRuUIE5xL8yhRCagNr5ZW250aa+wBwu5DSCk5fDNr0eDuZjw84WHDll+mHxBFGV+X\nKJ5jCOmGumGqjVWZesJpNN1My3M9bsY9layNJJ0eiDeHDEi/yXhhO/mNEXhvhq/R\nfN0Jh2A3AgMBAAECggEAef+CEL5aF6/aVs0yh7fiXkKSp1ECXkud8ztgpEn63KJF\nXM1EdnBt50fA2xSQUeGmeEXi6+cngf0nRb8FToAEgLoGoOEjSJuLrzP3I8U9Fe3m\nBRG2uZI2Ti/bD0eRGEc1oSDhCpsqnkTGK1bwcD4AKpwY+c08Izh/2BOoY6McDoqh\ndQ89jzTuMtD4cNlnPiIrY9HbxoNjshK2ax1OaeXyYKZFG1TxqMFv5gA/G5+S3Cwr\nVG4fkAxYi5vdIK3b8jUXrTM/kpoTl+d3dlQ7rRZYf7KyT31/HtJ/GNzxFI6upzO7\niDNrrUOyeOPjWXdzUh9budv3j+6UfbYK7uZIoebHIQKBgQDykYX1L/akGaOC2tfS\njzCWUzPxGFYVZQ7zD1PM6UyouuS1KLURDEGk9RxqVzTPh/pYd8Ivnz3vOVski5Zt\n19ozLGxdtDhn122DcnVpfCdYzHBdAzPCzORenFohX+MhiX5fEotTlVi7wfOmzTP5\nhUCMSd/17bJrV4XMLhkdrMRBFQKBgQDH5fwV7o+Ej/ZfcdGIa3mAFazToPDzxhHU\nnwADxaxpNGKRU03XCaiYkykarLYdG6Rk+7dXUv8eLy+6Dcq1SWQtfCWKEor++IIp\n1RwWmFHfYriHGkmxSkkEkLFvL8old9xM5YWbEXc4QIXvnfR4BZxdyJHVzIDdbI2i\nFgcn17U3GwKBgDd1njMY7ENIuWHJt16k7m7wRwfwkH4DxQ89ieNn0+cgE/p3fC6R\nptCYWg7WMXThmhNwDi3lMrvnWTdZ0uL6XyEkHwKtmdfkIV3UZZPglv5uf6JEgSkg\nv3YCOXk3+y5HyWTjUIejtc334kVY1XFPThrFKTeJSSnRsP2l7IgkYBqhAoGAYGsr\nM3z1FrDF2nWw5odIfKJ30UAw2LRyB0eGH0uqhLgyzvwKcK2E98sLqYUi9llN6zOK\n1IEA8xM5hxl97AFxY4sdJEMbbi55wim7uZ5Q51nbvbbNUsmM/Lm6C/JWI8pzpVeU\nIR7EjYp50AE1WOsD6CyFQ0W35pWkn0jWvL4L938CgYEAlax4dLE5+YCG5DeLT1/N\nin6kQjl7JS4oCNlPEj6aRPLX2OJresI7oOn+uNatKvlVyfPm6rdxeHCmER1FpR7Q\nA/aNVjPeViKT/R4nK9ytsa+s/1IJVrwLFHJK3toGE660g5w3vKrCjWisMdP4yzzQ\nbv1KwcKoQbNVXwauH79JKc0=\n-----END PRIVATE KEY-----\n" { |
| 3840 | - t.Errorf("bad secret_key: %q", gcs.SecretKey) |
| 3841 | - } |
| 3842 | - if gcs.Path != "/path" { |
| 3843 | - t.Errorf("bad path: %q", gcs.Path) |
| 3844 | - } |
| 3845 | - if gcs.Period != 12 { |
| 3846 | - t.Errorf("bad period: %q", gcs.Period) |
| 3847 | - } |
| 3848 | - if gcs.GzipLevel != 9 { |
| 3849 | - t.Errorf("bad gzip_level: %q", gcs.GzipLevel) |
| 3850 | - } |
| 3851 | - if gcs.FormatVersion != 2 { |
| 3852 | - t.Errorf("bad format_version: %q", gcs.FormatVersion) |
| 3853 | - } |
| 3854 | - if gcs.Format != "format" { |
| 3855 | - t.Errorf("bad format: %q", gcs.Format) |
| 3856 | - } |
| 3857 | - if gcs.TimestampFormat != "%Y" { |
| 3858 | - t.Errorf("bad timestamp_format: %q", gcs.TimestampFormat) |
| 3859 | - } |
| 3860 | - if gcs.MessageType != "blank" { |
| 3861 | - t.Errorf("bad message_type: %q", gcs.MessageType) |
| 3862 | - } |
| 3863 | - if gcs.Placement != "waf_debug" { |
| 3864 | - t.Errorf("bad placement: %q", gcs.Placement) |
| 3865 | - } |
| 3866 | - |
| 3867 | - // List |
| 3868 | - var gcses []*GCS |
| 3869 | - record(t, "gcses/list", func(c *Client) { |
| 3870 | - gcses, err = c.ListGCSs(&ListGCSsInput{ |
| 3871 | - Service: testServiceID, |
| 3872 | - Version: tv.Number, |
| 3873 | - }) |
| 3874 | - }) |
| 3875 | - if err != nil { |
| 3876 | - t.Fatal(err) |
| 3877 | - } |
| 3878 | - if len(gcses) < 1 { |
| 3879 | - t.Errorf("bad gcses: %v", gcses) |
| 3880 | - } |
| 3881 | - |
| 3882 | - // Get |
| 3883 | - var ngcs *GCS |
| 3884 | - record(t, "gcses/get", func(c *Client) { |
| 3885 | - ngcs, err = c.GetGCS(&GetGCSInput{ |
| 3886 | - Service: testServiceID, |
| 3887 | - Version: tv.Number, |
| 3888 | - Name: "test-gcs", |
| 3889 | - }) |
| 3890 | - }) |
| 3891 | - if err != nil { |
| 3892 | - t.Fatal(err) |
| 3893 | - } |
| 3894 | - if gcs.Name != ngcs.Name { |
| 3895 | - t.Errorf("bad name: %q", gcs.Name) |
| 3896 | - } |
| 3897 | - if gcs.Bucket != ngcs.Bucket { |
| 3898 | - t.Errorf("bad bucket: %q", gcs.Bucket) |
| 3899 | - } |
| 3900 | - if gcs.User != ngcs.User { |
| 3901 | - t.Errorf("bad user: %q", gcs.User) |
| 3902 | - } |
| 3903 | - if gcs.SecretKey != ngcs.SecretKey { |
| 3904 | - t.Errorf("bad secret_key: %q", gcs.SecretKey) |
| 3905 | - } |
| 3906 | - if gcs.Path != ngcs.Path { |
| 3907 | - t.Errorf("bad path: %q", gcs.Path) |
| 3908 | - } |
| 3909 | - if gcs.Period != ngcs.Period { |
| 3910 | - t.Errorf("bad period: %q", gcs.Period) |
| 3911 | - } |
| 3912 | - if gcs.GzipLevel != ngcs.GzipLevel { |
| 3913 | - t.Errorf("bad gzip_level: %q", gcs.GzipLevel) |
| 3914 | - } |
| 3915 | - if gcs.FormatVersion != ngcs.FormatVersion { |
| 3916 | - t.Errorf("bad format_version: %q", gcs.FormatVersion) |
| 3917 | - } |
| 3918 | - if gcs.Format != ngcs.Format { |
| 3919 | - t.Errorf("bad format: %q", gcs.Format) |
| 3920 | - } |
| 3921 | - if gcs.TimestampFormat != ngcs.TimestampFormat { |
| 3922 | - t.Errorf("bad timestamp_format: %q", gcs.TimestampFormat) |
| 3923 | - } |
| 3924 | - if gcs.MessageType != ngcs.MessageType { |
| 3925 | - t.Errorf("bad message_type: %q", gcs.MessageType) |
| 3926 | - } |
| 3927 | - if gcs.Placement != ngcs.Placement { |
| 3928 | - t.Errorf("bad placement: %q", gcs.Placement) |
| 3929 | - } |
| 3930 | - |
| 3931 | - // Update |
| 3932 | - var ugcs *GCS |
| 3933 | - record(t, "gcses/update", func(c *Client) { |
| 3934 | - ugcs, err = c.UpdateGCS(&UpdateGCSInput{ |
| 3935 | - Service: testServiceID, |
| 3936 | - Version: tv.Number, |
| 3937 | - Name: "test-gcs", |
| 3938 | - NewName: "new-test-gcs", |
| 3939 | - }) |
| 3940 | - }) |
| 3941 | - if err != nil { |
| 3942 | - t.Fatal(err) |
| 3943 | - } |
| 3944 | - if ugcs.Name != "new-test-gcs" { |
| 3945 | - t.Errorf("bad name: %q", ugcs.Name) |
| 3946 | - } |
| 3947 | - |
| 3948 | - // Delete |
| 3949 | - record(t, "gcses/delete", func(c *Client) { |
| 3950 | - err = c.DeleteGCS(&DeleteGCSInput{ |
| 3951 | - Service: testServiceID, |
| 3952 | - Version: tv.Number, |
| 3953 | - Name: "new-test-gcs", |
| 3954 | - }) |
| 3955 | - }) |
| 3956 | - if err != nil { |
| 3957 | - t.Fatal(err) |
| 3958 | - } |
| 3959 | } |
| 3960 | |
| 3961 | func TestClient_ListGCSs_validation(t *testing.T) { |
| 3962 | Index: golang-github-sethvargo-go-fastly/fastly/gzip_test.go |
| 3963 | =================================================================== |
| 3964 | --- golang-github-sethvargo-go-fastly.orig/fastly/gzip_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 3965 | +++ golang-github-sethvargo-go-fastly/fastly/gzip_test.go 2019-08-22 13:47:49.750072885 +0000 |
| 3966 | @@ -3,146 +3,6 @@ |
| 3967 | import "testing" |
| 3968 | |
| 3969 | func TestClient_Gzips(t *testing.T) { |
| 3970 | - t.Parallel() |
| 3971 | - |
| 3972 | - var err error |
| 3973 | - var tv *Version |
| 3974 | - record(t, "gzips/version", func(c *Client) { |
| 3975 | - tv = testVersion(t, c) |
| 3976 | - }) |
| 3977 | - |
| 3978 | - // Create |
| 3979 | - var gzip *Gzip |
| 3980 | - record(t, "gzips/create", func(c *Client) { |
| 3981 | - gzip, err = c.CreateGzip(&CreateGzipInput{ |
| 3982 | - Service: testServiceID, |
| 3983 | - Version: tv.Number, |
| 3984 | - Name: "test-gzip", |
| 3985 | - ContentTypes: "text/html text/css", |
| 3986 | - Extensions: "html css", |
| 3987 | - }) |
| 3988 | - }) |
| 3989 | - if err != nil { |
| 3990 | - t.Fatal(err) |
| 3991 | - } |
| 3992 | - |
| 3993 | - // Create omissions (GH-7) |
| 3994 | - var gzipomit *Gzip |
| 3995 | - record(t, "gzips/create_omissions", func(c *Client) { |
| 3996 | - gzipomit, err = c.CreateGzip(&CreateGzipInput{ |
| 3997 | - Service: testServiceID, |
| 3998 | - Version: tv.Number, |
| 3999 | - Name: "test-gzip-omit", |
| 4000 | - }) |
| 4001 | - }) |
| 4002 | - if err != nil { |
| 4003 | - t.Fatal(err) |
| 4004 | - } |
| 4005 | - if gzipomit.ContentTypes != "" { |
| 4006 | - t.Errorf("bad content_types: %q", gzipomit.ContentTypes) |
| 4007 | - } |
| 4008 | - if gzipomit.Extensions != "" { |
| 4009 | - t.Errorf("bad extensions: %q", gzipomit.Extensions) |
| 4010 | - } |
| 4011 | - |
| 4012 | - // Ensure deleted |
| 4013 | - defer func() { |
| 4014 | - record(t, "gzips/cleanup", func(c *Client) { |
| 4015 | - c.DeleteGzip(&DeleteGzipInput{ |
| 4016 | - Service: testServiceID, |
| 4017 | - Version: tv.Number, |
| 4018 | - Name: "test-gzip", |
| 4019 | - }) |
| 4020 | - |
| 4021 | - c.DeleteGzip(&DeleteGzipInput{ |
| 4022 | - Service: testServiceID, |
| 4023 | - Version: tv.Number, |
| 4024 | - Name: "test-gzip-omit", |
| 4025 | - }) |
| 4026 | - |
| 4027 | - c.DeleteGzip(&DeleteGzipInput{ |
| 4028 | - Service: testServiceID, |
| 4029 | - Version: tv.Number, |
| 4030 | - Name: "new-test-gzip", |
| 4031 | - }) |
| 4032 | - }) |
| 4033 | - }() |
| 4034 | - |
| 4035 | - if gzip.Name != "test-gzip" { |
| 4036 | - t.Errorf("bad name: %q", gzip.Name) |
| 4037 | - } |
| 4038 | - if gzip.ContentTypes != "text/html text/css" { |
| 4039 | - t.Errorf("bad content_types: %q", gzip.ContentTypes) |
| 4040 | - } |
| 4041 | - if gzip.Extensions != "html css" { |
| 4042 | - t.Errorf("bad extensions: %q", gzip.Extensions) |
| 4043 | - } |
| 4044 | - |
| 4045 | - // List |
| 4046 | - var gzips []*Gzip |
| 4047 | - record(t, "gzips/list", func(c *Client) { |
| 4048 | - gzips, err = c.ListGzips(&ListGzipsInput{ |
| 4049 | - Service: testServiceID, |
| 4050 | - Version: tv.Number, |
| 4051 | - }) |
| 4052 | - }) |
| 4053 | - if err != nil { |
| 4054 | - t.Fatal(err) |
| 4055 | - } |
| 4056 | - if len(gzips) < 1 { |
| 4057 | - t.Errorf("bad gzips: %v", gzips) |
| 4058 | - } |
| 4059 | - |
| 4060 | - // Get |
| 4061 | - var ngzip *Gzip |
| 4062 | - record(t, "gzips/get", func(c *Client) { |
| 4063 | - ngzip, err = c.GetGzip(&GetGzipInput{ |
| 4064 | - Service: testServiceID, |
| 4065 | - Version: tv.Number, |
| 4066 | - Name: "test-gzip", |
| 4067 | - }) |
| 4068 | - }) |
| 4069 | - if err != nil { |
| 4070 | - t.Fatal(err) |
| 4071 | - } |
| 4072 | - if ngzip.Name != gzip.Name { |
| 4073 | - t.Errorf("bad name: %q", ngzip.Name) |
| 4074 | - } |
| 4075 | - if ngzip.ContentTypes != gzip.ContentTypes { |
| 4076 | - t.Errorf("bad content_types: %q", ngzip.ContentTypes) |
| 4077 | - } |
| 4078 | - if ngzip.Extensions != gzip.Extensions { |
| 4079 | - t.Errorf("bad extensions: %q", ngzip.Extensions) |
| 4080 | - } |
| 4081 | - |
| 4082 | - // Update |
| 4083 | - var ugzip *Gzip |
| 4084 | - record(t, "gzips/update", func(c *Client) { |
| 4085 | - ugzip, err = c.UpdateGzip(&UpdateGzipInput{ |
| 4086 | - Service: testServiceID, |
| 4087 | - Version: tv.Number, |
| 4088 | - Name: "test-gzip", |
| 4089 | - NewName: "new-test-gzip", |
| 4090 | - }) |
| 4091 | - }) |
| 4092 | - if err != nil { |
| 4093 | - t.Fatal(err) |
| 4094 | - } |
| 4095 | - if ugzip.Name != "new-test-gzip" { |
| 4096 | - t.Errorf("bad name: %q", ugzip.Name) |
| 4097 | - } |
| 4098 | - |
| 4099 | - // Delete |
| 4100 | - record(t, "gzips/delete", func(c *Client) { |
| 4101 | - err = c.DeleteGzip(&DeleteGzipInput{ |
| 4102 | - Service: testServiceID, |
| 4103 | - Version: tv.Number, |
| 4104 | - Name: "new-test-gzip", |
| 4105 | - }) |
| 4106 | - }) |
| 4107 | - if err != nil { |
| 4108 | - t.Fatal(err) |
| 4109 | - } |
| 4110 | } |
| 4111 | |
| 4112 | func TestClient_ListGzips_validation(t *testing.T) { |
| 4113 | Index: golang-github-sethvargo-go-fastly/fastly/header_test.go |
| 4114 | =================================================================== |
| 4115 | --- golang-github-sethvargo-go-fastly.orig/fastly/header_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 4116 | +++ golang-github-sethvargo-go-fastly/fastly/header_test.go 2019-08-22 13:45:55.953012742 +0000 |
| 4117 | @@ -3,163 +3,6 @@ |
| 4118 | import "testing" |
| 4119 | |
| 4120 | func TestClient_Headers(t *testing.T) { |
| 4121 | - t.Parallel() |
| 4122 | - |
| 4123 | - var err error |
| 4124 | - var tv *Version |
| 4125 | - record(t, "headers/version", func(c *Client) { |
| 4126 | - tv = testVersion(t, c) |
| 4127 | - }) |
| 4128 | - |
| 4129 | - // Create |
| 4130 | - var h *Header |
| 4131 | - record(t, "headers/create", func(c *Client) { |
| 4132 | - h, err = c.CreateHeader(&CreateHeaderInput{ |
| 4133 | - Service: testServiceID, |
| 4134 | - Version: tv.Number, |
| 4135 | - Name: "test-header", |
| 4136 | - Action: HeaderActionSet, |
| 4137 | - IgnoreIfSet: CBool(false), |
| 4138 | - Type: HeaderTypeRequest, |
| 4139 | - Destination: "http.foo", |
| 4140 | - Source: "client.ip", |
| 4141 | - Regex: "foobar", |
| 4142 | - Substitution: "123", |
| 4143 | - Priority: 50, |
| 4144 | - }) |
| 4145 | - }) |
| 4146 | - if err != nil { |
| 4147 | - t.Fatal(err) |
| 4148 | - } |
| 4149 | - |
| 4150 | - // Ensure deleted |
| 4151 | - defer func() { |
| 4152 | - record(t, "headers/cleanup", func(c *Client) { |
| 4153 | - c.DeleteHeader(&DeleteHeaderInput{ |
| 4154 | - Service: testServiceID, |
| 4155 | - Version: tv.Number, |
| 4156 | - Name: "test-header", |
| 4157 | - }) |
| 4158 | - |
| 4159 | - c.DeleteHeader(&DeleteHeaderInput{ |
| 4160 | - Service: testServiceID, |
| 4161 | - Version: tv.Number, |
| 4162 | - Name: "new-test-header", |
| 4163 | - }) |
| 4164 | - }) |
| 4165 | - }() |
| 4166 | - |
| 4167 | - if h.Name != "test-header" { |
| 4168 | - t.Errorf("bad name: %q", h.Name) |
| 4169 | - } |
| 4170 | - if h.Action != HeaderActionSet { |
| 4171 | - t.Errorf("bad header_action_set: %q", h.Action) |
| 4172 | - } |
| 4173 | - if h.IgnoreIfSet != false { |
| 4174 | - t.Errorf("bad ignore_if_set: %t", h.IgnoreIfSet) |
| 4175 | - } |
| 4176 | - if h.Type != HeaderTypeRequest { |
| 4177 | - t.Errorf("bad type: %q", h.Type) |
| 4178 | - } |
| 4179 | - if h.Destination != "http.foo" { |
| 4180 | - t.Errorf("bad destination: %q", h.Destination) |
| 4181 | - } |
| 4182 | - if h.Source != "client.ip" { |
| 4183 | - t.Errorf("bad source: %q", h.Source) |
| 4184 | - } |
| 4185 | - if h.Regex != "foobar" { |
| 4186 | - t.Errorf("bad regex: %q", h.Regex) |
| 4187 | - } |
| 4188 | - if h.Substitution != "123" { |
| 4189 | - t.Errorf("bad substitution: %q", h.Substitution) |
| 4190 | - } |
| 4191 | - if h.Priority != 50 { |
| 4192 | - t.Errorf("bad priority: %d", h.Priority) |
| 4193 | - } |
| 4194 | - |
| 4195 | - // List |
| 4196 | - var hs []*Header |
| 4197 | - record(t, "headers/list", func(c *Client) { |
| 4198 | - hs, err = c.ListHeaders(&ListHeadersInput{ |
| 4199 | - Service: testServiceID, |
| 4200 | - Version: tv.Number, |
| 4201 | - }) |
| 4202 | - }) |
| 4203 | - if err != nil { |
| 4204 | - t.Fatal(err) |
| 4205 | - } |
| 4206 | - if len(hs) < 1 { |
| 4207 | - t.Errorf("bad headers: %v", hs) |
| 4208 | - } |
| 4209 | - |
| 4210 | - // Get |
| 4211 | - var nh *Header |
| 4212 | - record(t, "headers/get", func(c *Client) { |
| 4213 | - nh, err = c.GetHeader(&GetHeaderInput{ |
| 4214 | - Service: testServiceID, |
| 4215 | - Version: tv.Number, |
| 4216 | - Name: "test-header", |
| 4217 | - }) |
| 4218 | - }) |
| 4219 | - if err != nil { |
| 4220 | - t.Fatal(err) |
| 4221 | - } |
| 4222 | - if h.Name != nh.Name { |
| 4223 | - t.Errorf("bad name: %q (%q)", h.Name, nh.Name) |
| 4224 | - } |
| 4225 | - if h.Action != nh.Action { |
| 4226 | - t.Errorf("bad header_action_set: %q", h.Action) |
| 4227 | - } |
| 4228 | - if h.IgnoreIfSet != nh.IgnoreIfSet { |
| 4229 | - t.Errorf("bad ignore_if_set: %t", h.IgnoreIfSet) |
| 4230 | - } |
| 4231 | - if h.Type != nh.Type { |
| 4232 | - t.Errorf("bad type: %q", h.Type) |
| 4233 | - } |
| 4234 | - if h.Destination != nh.Destination { |
| 4235 | - t.Errorf("bad destination: %q", h.Destination) |
| 4236 | - } |
| 4237 | - if h.Source != nh.Source { |
| 4238 | - t.Errorf("bad source: %q", h.Source) |
| 4239 | - } |
| 4240 | - if h.Regex != nh.Regex { |
| 4241 | - t.Errorf("bad regex: %q", h.Regex) |
| 4242 | - } |
| 4243 | - if h.Substitution != nh.Substitution { |
| 4244 | - t.Errorf("bad substitution: %q", h.Substitution) |
| 4245 | - } |
| 4246 | - if h.Priority != nh.Priority { |
| 4247 | - t.Errorf("bad priority: %d", h.Priority) |
| 4248 | - } |
| 4249 | - |
| 4250 | - // Update |
| 4251 | - var uh *Header |
| 4252 | - record(t, "headers/update", func(c *Client) { |
| 4253 | - uh, err = c.UpdateHeader(&UpdateHeaderInput{ |
| 4254 | - Service: testServiceID, |
| 4255 | - Version: tv.Number, |
| 4256 | - Name: "test-header", |
| 4257 | - NewName: "new-test-header", |
| 4258 | - }) |
| 4259 | - }) |
| 4260 | - if err != nil { |
| 4261 | - t.Fatal(err) |
| 4262 | - } |
| 4263 | - if uh.Name != "new-test-header" { |
| 4264 | - t.Errorf("bad name: %q", uh.Name) |
| 4265 | - } |
| 4266 | - |
| 4267 | - // Delete |
| 4268 | - record(t, "headers/delete", func(c *Client) { |
| 4269 | - err = c.DeleteHeader(&DeleteHeaderInput{ |
| 4270 | - Service: testServiceID, |
| 4271 | - Version: tv.Number, |
| 4272 | - Name: "new-test-header", |
| 4273 | - }) |
| 4274 | - }) |
| 4275 | - if err != nil { |
| 4276 | - t.Fatal(err) |
| 4277 | - } |
| 4278 | } |
| 4279 | |
| 4280 | func TestClient_ListHeaders_validation(t *testing.T) { |
| 4281 | Index: golang-github-sethvargo-go-fastly/fastly/health_check_test.go |
| 4282 | =================================================================== |
| 4283 | --- golang-github-sethvargo-go-fastly.orig/fastly/health_check_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 4284 | +++ golang-github-sethvargo-go-fastly/fastly/health_check_test.go 2019-08-22 13:47:10.792340579 +0000 |
| 4285 | @@ -3,177 +3,6 @@ |
| 4286 | import "testing" |
| 4287 | |
| 4288 | func TestClient_HealthChecks(t *testing.T) { |
| 4289 | - t.Parallel() |
| 4290 | - |
| 4291 | - var err error |
| 4292 | - var tv *Version |
| 4293 | - record(t, "health_checks/version", func(c *Client) { |
| 4294 | - tv = testVersion(t, c) |
| 4295 | - }) |
| 4296 | - |
| 4297 | - // Create |
| 4298 | - var hc *HealthCheck |
| 4299 | - record(t, "health_checks/create", func(c *Client) { |
| 4300 | - hc, err = c.CreateHealthCheck(&CreateHealthCheckInput{ |
| 4301 | - Service: testServiceID, |
| 4302 | - Version: tv.Number, |
| 4303 | - Name: "test-healthcheck", |
| 4304 | - Method: "HEAD", |
| 4305 | - Host: "example.com", |
| 4306 | - Path: "/foo", |
| 4307 | - HTTPVersion: "1.1", |
| 4308 | - Timeout: 1500, |
| 4309 | - CheckInterval: 2500, |
| 4310 | - ExpectedResponse: 200, |
| 4311 | - Window: 5000, |
| 4312 | - Threshold: 10, |
| 4313 | - Initial: 10, |
| 4314 | - }) |
| 4315 | - }) |
| 4316 | - if err != nil { |
| 4317 | - t.Fatal(err) |
| 4318 | - } |
| 4319 | - |
| 4320 | - // Ensure deleted |
| 4321 | - defer func() { |
| 4322 | - record(t, "health_checks/cleanup", func(c *Client) { |
| 4323 | - c.DeleteHealthCheck(&DeleteHealthCheckInput{ |
| 4324 | - Service: testServiceID, |
| 4325 | - Version: tv.Number, |
| 4326 | - Name: "test-healthcheck", |
| 4327 | - }) |
| 4328 | - |
| 4329 | - c.DeleteHealthCheck(&DeleteHealthCheckInput{ |
| 4330 | - Service: testServiceID, |
| 4331 | - Version: tv.Number, |
| 4332 | - Name: "new-test-healthcheck", |
| 4333 | - }) |
| 4334 | - }) |
| 4335 | - }() |
| 4336 | - |
| 4337 | - if hc.Name != "test-healthcheck" { |
| 4338 | - t.Errorf("bad name: %q", hc.Name) |
| 4339 | - } |
| 4340 | - if hc.Method != "HEAD" { |
| 4341 | - t.Errorf("bad address: %q", hc.Method) |
| 4342 | - } |
| 4343 | - if hc.Host != "example.com" { |
| 4344 | - t.Errorf("bad host: %q", hc.Host) |
| 4345 | - } |
| 4346 | - if hc.Path != "/foo" { |
| 4347 | - t.Errorf("bad path: %q", hc.Path) |
| 4348 | - } |
| 4349 | - if hc.HTTPVersion != "1.1" { |
| 4350 | - t.Errorf("bad http_version: %q", hc.HTTPVersion) |
| 4351 | - } |
| 4352 | - if hc.Timeout != 1500 { |
| 4353 | - t.Errorf("bad timeout: %q", hc.Timeout) |
| 4354 | - } |
| 4355 | - if hc.CheckInterval != 2500 { |
| 4356 | - t.Errorf("bad check_interval: %q", hc.CheckInterval) |
| 4357 | - } |
| 4358 | - if hc.ExpectedResponse != 200 { |
| 4359 | - t.Errorf("bad timeout: %q", hc.ExpectedResponse) |
| 4360 | - } |
| 4361 | - if hc.Window != 5000 { |
| 4362 | - t.Errorf("bad window: %q", hc.Window) |
| 4363 | - } |
| 4364 | - if hc.Threshold != 10 { |
| 4365 | - t.Errorf("bad threshold: %q", hc.Threshold) |
| 4366 | - } |
| 4367 | - if hc.Initial != 10 { |
| 4368 | - t.Errorf("bad initial: %q", hc.Initial) |
| 4369 | - } |
| 4370 | - |
| 4371 | - // List |
| 4372 | - var hcs []*HealthCheck |
| 4373 | - record(t, "health_checks/list", func(c *Client) { |
| 4374 | - hcs, err = c.ListHealthChecks(&ListHealthChecksInput{ |
| 4375 | - Service: testServiceID, |
| 4376 | - Version: tv.Number, |
| 4377 | - }) |
| 4378 | - }) |
| 4379 | - if err != nil { |
| 4380 | - t.Fatal(err) |
| 4381 | - } |
| 4382 | - if len(hcs) < 1 { |
| 4383 | - t.Errorf("bad health checks: %v", hcs) |
| 4384 | - } |
| 4385 | - |
| 4386 | - // Get |
| 4387 | - var nhc *HealthCheck |
| 4388 | - record(t, "health_checks/get", func(c *Client) { |
| 4389 | - nhc, err = c.GetHealthCheck(&GetHealthCheckInput{ |
| 4390 | - Service: testServiceID, |
| 4391 | - Version: tv.Number, |
| 4392 | - Name: "test-healthcheck", |
| 4393 | - }) |
| 4394 | - }) |
| 4395 | - if err != nil { |
| 4396 | - t.Fatal(err) |
| 4397 | - } |
| 4398 | - if hc.Name != nhc.Name { |
| 4399 | - t.Errorf("bad name: %q (%q)", hc.Name, nhc.Name) |
| 4400 | - } |
| 4401 | - if hc.Method != nhc.Method { |
| 4402 | - t.Errorf("bad address: %q", hc.Method) |
| 4403 | - } |
| 4404 | - if hc.Host != nhc.Host { |
| 4405 | - t.Errorf("bad host: %q", hc.Host) |
| 4406 | - } |
| 4407 | - if hc.Path != nhc.Path { |
| 4408 | - t.Errorf("bad path: %q", hc.Path) |
| 4409 | - } |
| 4410 | - if hc.HTTPVersion != nhc.HTTPVersion { |
| 4411 | - t.Errorf("bad http_version: %q", hc.HTTPVersion) |
| 4412 | - } |
| 4413 | - if hc.Timeout != nhc.Timeout { |
| 4414 | - t.Errorf("bad timeout: %q", hc.Timeout) |
| 4415 | - } |
| 4416 | - if hc.CheckInterval != nhc.CheckInterval { |
| 4417 | - t.Errorf("bad check_interval: %q", hc.CheckInterval) |
| 4418 | - } |
| 4419 | - if hc.ExpectedResponse != nhc.ExpectedResponse { |
| 4420 | - t.Errorf("bad timeout: %q", hc.ExpectedResponse) |
| 4421 | - } |
| 4422 | - if hc.Window != nhc.Window { |
| 4423 | - t.Errorf("bad window: %q", hc.Window) |
| 4424 | - } |
| 4425 | - if hc.Threshold != nhc.Threshold { |
| 4426 | - t.Errorf("bad threshold: %q", hc.Threshold) |
| 4427 | - } |
| 4428 | - if hc.Initial != nhc.Initial { |
| 4429 | - t.Errorf("bad initial: %q", hc.Initial) |
| 4430 | - } |
| 4431 | - |
| 4432 | - // Update |
| 4433 | - var uhc *HealthCheck |
| 4434 | - record(t, "health_checks/update", func(c *Client) { |
| 4435 | - uhc, err = c.UpdateHealthCheck(&UpdateHealthCheckInput{ |
| 4436 | - Service: testServiceID, |
| 4437 | - Version: tv.Number, |
| 4438 | - Name: "test-healthcheck", |
| 4439 | - NewName: "new-test-healthcheck", |
| 4440 | - }) |
| 4441 | - }) |
| 4442 | - if err != nil { |
| 4443 | - t.Fatal(err) |
| 4444 | - } |
| 4445 | - if uhc.Name != "new-test-healthcheck" { |
| 4446 | - t.Errorf("bad name: %q", uhc.Name) |
| 4447 | - } |
| 4448 | - |
| 4449 | - // Delete |
| 4450 | - record(t, "health_checks/delete", func(c *Client) { |
| 4451 | - err = c.DeleteHealthCheck(&DeleteHealthCheckInput{ |
| 4452 | - Service: testServiceID, |
| 4453 | - Version: tv.Number, |
| 4454 | - Name: "new-test-healthcheck", |
| 4455 | - }) |
| 4456 | - }) |
| 4457 | - if err != nil { |
| 4458 | - t.Fatal(err) |
| 4459 | - } |
| 4460 | } |
| 4461 | |
| 4462 | func TestClient_ListHealthChecks_validation(t *testing.T) { |
| 4463 | Index: golang-github-sethvargo-go-fastly/fastly/logentries_test.go |
| 4464 | =================================================================== |
| 4465 | --- golang-github-sethvargo-go-fastly.orig/fastly/logentries_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 4466 | +++ golang-github-sethvargo-go-fastly/fastly/logentries_test.go 2019-08-22 13:46:32.322629967 +0000 |
| 4467 | @@ -3,152 +3,6 @@ |
| 4468 | import "testing" |
| 4469 | |
| 4470 | func TestClient_Logentries(t *testing.T) { |
| 4471 | - t.Parallel() |
| 4472 | - |
| 4473 | - var err error |
| 4474 | - var tv *Version |
| 4475 | - record(t, "logentries/version", func(c *Client) { |
| 4476 | - tv = testVersion(t, c) |
| 4477 | - }) |
| 4478 | - |
| 4479 | - // Create |
| 4480 | - var le *Logentries |
| 4481 | - record(t, "logentries/create", func(c *Client) { |
| 4482 | - le, err = c.CreateLogentries(&CreateLogentriesInput{ |
| 4483 | - Service: testServiceID, |
| 4484 | - Version: tv.Number, |
| 4485 | - Name: "test-logentries", |
| 4486 | - Port: 1234, |
| 4487 | - UseTLS: CBool(true), |
| 4488 | - Token: "abcd1234", |
| 4489 | - Format: "format", |
| 4490 | - Placement: "waf_debug", |
| 4491 | - }) |
| 4492 | - }) |
| 4493 | - if err != nil { |
| 4494 | - t.Fatal(err) |
| 4495 | - } |
| 4496 | - |
| 4497 | - // Ensure deleted |
| 4498 | - defer func() { |
| 4499 | - record(t, "logentries/delete", func(c *Client) { |
| 4500 | - c.DeleteLogentries(&DeleteLogentriesInput{ |
| 4501 | - Service: testServiceID, |
| 4502 | - Version: tv.Number, |
| 4503 | - Name: "test-logentries", |
| 4504 | - }) |
| 4505 | - |
| 4506 | - c.DeleteLogentries(&DeleteLogentriesInput{ |
| 4507 | - Service: testServiceID, |
| 4508 | - Version: tv.Number, |
| 4509 | - Name: "new-test-logentries", |
| 4510 | - }) |
| 4511 | - }) |
| 4512 | - }() |
| 4513 | - |
| 4514 | - if le.Name != "test-logentries" { |
| 4515 | - t.Errorf("bad name: %q", le.Name) |
| 4516 | - } |
| 4517 | - if le.Port != 1234 { |
| 4518 | - t.Errorf("bad port: %q", le.Port) |
| 4519 | - } |
| 4520 | - if le.UseTLS != true { |
| 4521 | - t.Errorf("bad use_tls: %t", le.UseTLS) |
| 4522 | - } |
| 4523 | - if le.Token != "abcd1234" { |
| 4524 | - t.Errorf("bad token: %q", le.Token) |
| 4525 | - } |
| 4526 | - if le.Format != "format" { |
| 4527 | - t.Errorf("bad format: %q", le.Format) |
| 4528 | - } |
| 4529 | - if le.FormatVersion != 2 { |
| 4530 | - t.Errorf("bad format_version: %q", le.FormatVersion) |
| 4531 | - } |
| 4532 | - if le.Placement != "waf_debug" { |
| 4533 | - t.Errorf("bad placement: %q", le.Placement) |
| 4534 | - } |
| 4535 | - |
| 4536 | - // List |
| 4537 | - var les []*Logentries |
| 4538 | - record(t, "logentries/list", func(c *Client) { |
| 4539 | - les, err = c.ListLogentries(&ListLogentriesInput{ |
| 4540 | - Service: testServiceID, |
| 4541 | - Version: tv.Number, |
| 4542 | - }) |
| 4543 | - }) |
| 4544 | - if err != nil { |
| 4545 | - t.Fatal(err) |
| 4546 | - } |
| 4547 | - if len(les) < 1 { |
| 4548 | - t.Errorf("bad logentriess: %v", les) |
| 4549 | - } |
| 4550 | - |
| 4551 | - // Get |
| 4552 | - var nle *Logentries |
| 4553 | - record(t, "logentries/get", func(c *Client) { |
| 4554 | - nle, err = c.GetLogentries(&GetLogentriesInput{ |
| 4555 | - Service: testServiceID, |
| 4556 | - Version: tv.Number, |
| 4557 | - Name: "test-logentries", |
| 4558 | - }) |
| 4559 | - }) |
| 4560 | - if err != nil { |
| 4561 | - t.Fatal(err) |
| 4562 | - } |
| 4563 | - if le.Name != nle.Name { |
| 4564 | - t.Errorf("bad name: %q", le.Name) |
| 4565 | - } |
| 4566 | - if le.Port != nle.Port { |
| 4567 | - t.Errorf("bad port: %q", le.Port) |
| 4568 | - } |
| 4569 | - if le.UseTLS != nle.UseTLS { |
| 4570 | - t.Errorf("bad use_tls: %t", le.UseTLS) |
| 4571 | - } |
| 4572 | - if le.Token != nle.Token { |
| 4573 | - t.Errorf("bad token: %q", le.Token) |
| 4574 | - } |
| 4575 | - if le.Format != nle.Format { |
| 4576 | - t.Errorf("bad format: %q", le.Format) |
| 4577 | - } |
| 4578 | - if le.FormatVersion != nle.FormatVersion { |
| 4579 | - t.Errorf("bad format_version: %q", le.FormatVersion) |
| 4580 | - } |
| 4581 | - if le.Placement != nle.Placement { |
| 4582 | - t.Errorf("bad placement: %q", le.Placement) |
| 4583 | - } |
| 4584 | - |
| 4585 | - // Update |
| 4586 | - var ule *Logentries |
| 4587 | - record(t, "logentries/update", func(c *Client) { |
| 4588 | - ule, err = c.UpdateLogentries(&UpdateLogentriesInput{ |
| 4589 | - Service: testServiceID, |
| 4590 | - Version: tv.Number, |
| 4591 | - Name: "test-logentries", |
| 4592 | - NewName: "new-test-logentries", |
| 4593 | - FormatVersion: 2, |
| 4594 | - }) |
| 4595 | - }) |
| 4596 | - if err != nil { |
| 4597 | - t.Fatal(err) |
| 4598 | - } |
| 4599 | - if ule.Name != "new-test-logentries" { |
| 4600 | - t.Errorf("bad name: %q", ule.Name) |
| 4601 | - } |
| 4602 | - if ule.FormatVersion != 2 { |
| 4603 | - t.Errorf("bad format_version: %q", ule.FormatVersion) |
| 4604 | - } |
| 4605 | - |
| 4606 | - // Delete |
| 4607 | - record(t, "logentries/delete", func(c *Client) { |
| 4608 | - err = c.DeleteLogentries(&DeleteLogentriesInput{ |
| 4609 | - Service: testServiceID, |
| 4610 | - Version: tv.Number, |
| 4611 | - Name: "new-test-logentries", |
| 4612 | - }) |
| 4613 | - }) |
| 4614 | - if err != nil { |
| 4615 | - t.Fatal(err) |
| 4616 | - } |
| 4617 | } |
| 4618 | |
| 4619 | func TestClient_ListLogentries_validation(t *testing.T) { |
| 4620 | Index: golang-github-sethvargo-go-fastly/fastly/purge_test.go |
| 4621 | =================================================================== |
| 4622 | --- golang-github-sethvargo-go-fastly.orig/fastly/purge_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 4623 | +++ golang-github-sethvargo-go-fastly/fastly/purge_test.go 2019-08-22 13:43:56.551703395 +0000 |
| 4624 | @@ -3,24 +3,4 @@ |
| 4625 | import "testing" |
| 4626 | |
| 4627 | func TestClient_Purge(t *testing.T) { |
| 4628 | - t.Parallel() |
| 4629 | - |
| 4630 | - var err error |
| 4631 | - var purge *Purge |
| 4632 | - record(t, "purges/purge_by_key", func(c *Client) { |
| 4633 | - purge, err = c.PurgeKey(&PurgeKeyInput{ |
| 4634 | - Service: testServiceID, |
| 4635 | - Key: "foo", |
| 4636 | - }) |
| 4637 | - }) |
| 4638 | - if err != nil { |
| 4639 | - t.Fatal(err) |
| 4640 | - } |
| 4641 | - |
| 4642 | - if purge.Status != "ok" { |
| 4643 | - t.Error("bad status") |
| 4644 | - } |
| 4645 | - if len(purge.ID) == 0 { |
| 4646 | - t.Error("bad id") |
| 4647 | - } |
| 4648 | } |
| 4649 | Index: golang-github-sethvargo-go-fastly/fastly/service_test.go |
| 4650 | =================================================================== |
| 4651 | --- golang-github-sethvargo-go-fastly.orig/fastly/service_test.go 2019-08-21 23:08:10.889972644 +0000 |
| 4652 | +++ golang-github-sethvargo-go-fastly/fastly/service_test.go 2019-08-22 13:45:22.039504728 +0000 |
| 4653 | @@ -3,159 +3,6 @@ |
| 4654 | import "testing" |
| 4655 | |
| 4656 | func TestClient_Services(t *testing.T) { |
| 4657 | - t.Parallel() |
| 4658 | - |
| 4659 | - var err error |
| 4660 | - |
| 4661 | - // Create |
| 4662 | - var s *Service |
| 4663 | - record(t, "services/create", func(c *Client) { |
| 4664 | - s, err = c.CreateService(&CreateServiceInput{ |
| 4665 | - Name: "test-service", |
| 4666 | - Comment: "comment", |
| 4667 | - }) |
| 4668 | - }) |
| 4669 | - if err != nil { |
| 4670 | - t.Fatal(err) |
| 4671 | - } |
| 4672 | - |
| 4673 | - // Ensure deleted |
| 4674 | - defer func() { |
| 4675 | - record(t, "services/cleanup", func(c *Client) { |
| 4676 | - c.DeleteService(&DeleteServiceInput{ |
| 4677 | - ID: s.ID, |
| 4678 | - }) |
| 4679 | - |
| 4680 | - c.DeleteService(&DeleteServiceInput{ |
| 4681 | - ID: s.ID, |
| 4682 | - }) |
| 4683 | - }) |
| 4684 | - }() |
| 4685 | - |
| 4686 | - if s.Name != "test-service" { |
| 4687 | - t.Errorf("bad name: %q", s.Name) |
| 4688 | - } |
| 4689 | - if s.Comment != "comment" { |
| 4690 | - t.Errorf("bad comment: %q", s.Comment) |
| 4691 | - } |
| 4692 | - |
| 4693 | - // List |
| 4694 | - var ss []*Service |
| 4695 | - record(t, "services/list", func(c *Client) { |
| 4696 | - ss, err = c.ListServices(&ListServicesInput{}) |
| 4697 | - }) |
| 4698 | - if err != nil { |
| 4699 | - t.Fatal(err) |
| 4700 | - } |
| 4701 | - if len(ss) < 1 { |
| 4702 | - t.Errorf("bad services: %v", ss) |
| 4703 | - } |
| 4704 | - |
| 4705 | - // Get |
| 4706 | - var ns *Service |
| 4707 | - record(t, "services/get", func(c *Client) { |
| 4708 | - ns, err = c.GetService(&GetServiceInput{ |
| 4709 | - ID: s.ID, |
| 4710 | - }) |
| 4711 | - }) |
| 4712 | - if err != nil { |
| 4713 | - t.Fatal(err) |
| 4714 | - } |
| 4715 | - if s.Name != ns.Name { |
| 4716 | - t.Errorf("bad name: %q (%q)", s.Name, ns.Name) |
| 4717 | - } |
| 4718 | - if s.Comment != ns.Comment { |
| 4719 | - t.Errorf("bad comment: %q (%q)", s.Comment, ns.Comment) |
| 4720 | - } |
| 4721 | - |
| 4722 | - if ns.CreatedAt == nil { |
| 4723 | - t.Errorf("Bad created at: empty") |
| 4724 | - } |
| 4725 | - |
| 4726 | - if ns.UpdatedAt == nil { |
| 4727 | - t.Errorf("Bad updated at: empty") |
| 4728 | - } |
| 4729 | - |
| 4730 | - if ns.DeletedAt != nil { |
| 4731 | - t.Errorf("Bad deleted at: %s", ns.DeletedAt) |
| 4732 | - } |
| 4733 | - |
| 4734 | - // Get Details |
| 4735 | - var nsd *ServiceDetail |
| 4736 | - record(t, "services/details", func(c *Client) { |
| 4737 | - nsd, err = c.GetServiceDetails(&GetServiceInput{ |
| 4738 | - ID: s.ID, |
| 4739 | - }) |
| 4740 | - }) |
| 4741 | - if err != nil { |
| 4742 | - t.Fatal(err) |
| 4743 | - } |
| 4744 | - |
| 4745 | - if s.Name != nsd.Name { |
| 4746 | - t.Errorf("bad name: %q (%q)", s.Name, nsd.Name) |
| 4747 | - } |
| 4748 | - if s.Comment != nsd.Comment { |
| 4749 | - t.Errorf("bad comment: %q (%q)", s.Comment, nsd.Comment) |
| 4750 | - } |
| 4751 | - if nsd.Version.Number == 0 { |
| 4752 | - t.Errorf("Service Detail Version is empty: (%#v)", nsd) |
| 4753 | - } |
| 4754 | - |
| 4755 | - // Search |
| 4756 | - var fs *Service |
| 4757 | - record(t, "services/search", func(c *Client) { |
| 4758 | - fs, err = c.SearchService(&SearchServiceInput{ |
| 4759 | - Name: "test-service", |
| 4760 | - }) |
| 4761 | - }) |
| 4762 | - if err != nil { |
| 4763 | - t.Fatal(err) |
| 4764 | - } |
| 4765 | - if s.Name != fs.Name { |
| 4766 | - t.Errorf("bad name: %q (%q)", s.Name, fs.Name) |
| 4767 | - } |
| 4768 | - if s.Comment != fs.Comment { |
| 4769 | - t.Errorf("bad comment: %q (%q)", s.Comment, fs.Comment) |
| 4770 | - } |
| 4771 | - |
| 4772 | - // Update |
| 4773 | - var us *Service |
| 4774 | - record(t, "services/update", func(c *Client) { |
| 4775 | - us, err = c.UpdateService(&UpdateServiceInput{ |
| 4776 | - ID: s.ID, |
| 4777 | - Name: "new-test-service", |
| 4778 | - }) |
| 4779 | - }) |
| 4780 | - if err != nil { |
| 4781 | - t.Fatal(err) |
| 4782 | - } |
| 4783 | - if us.Name != "new-test-service" { |
| 4784 | - t.Errorf("bad name: %q", us.Name) |
| 4785 | - } |
| 4786 | - |
| 4787 | - // Delete |
| 4788 | - record(t, "services/delete", func(c *Client) { |
| 4789 | - err = c.DeleteService(&DeleteServiceInput{ |
| 4790 | - ID: s.ID, |
| 4791 | - }) |
| 4792 | - }) |
| 4793 | - if err != nil { |
| 4794 | - t.Fatal(err) |
| 4795 | - } |
| 4796 | - |
| 4797 | - // List Domains |
| 4798 | - var ds ServiceDomainsList |
| 4799 | - record(t, "services/domain", func(c *Client) { |
| 4800 | - ds, err = c.ListServiceDomains(&ListServiceDomainInput{ |
| 4801 | - ID: s.ID, |
| 4802 | - }) |
| 4803 | - }) |
| 4804 | - if err != nil { |
| 4805 | - t.Fatal(err) |
| 4806 | - } |
| 4807 | - if len(ds) != 0 { |
| 4808 | - t.Fatalf("bad services: %v", ds) |
| 4809 | - } |
| 4810 | } |
| 4811 | |
| 4812 | func TestClient_GetService_validation(t *testing.T) { |
| 4813 | Index: golang-github-sethvargo-go-fastly/fastly/cache_setting_test.go |
| 4814 | =================================================================== |
| 4815 | --- golang-github-sethvargo-go-fastly.orig/fastly/cache_setting_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 4816 | +++ golang-github-sethvargo-go-fastly/fastly/cache_setting_test.go 2019-08-22 14:07:38.158917139 +0000 |
| 4817 | @@ -3,128 +3,6 @@ |
| 4818 | import "testing" |
| 4819 | |
| 4820 | func TestClient_CacheSettings(t *testing.T) { |
| 4821 | - t.Parallel() |
| 4822 | - |
| 4823 | - var err error |
| 4824 | - var tv *Version |
| 4825 | - record(t, "cache_settings/version", func(c *Client) { |
| 4826 | - tv = testVersion(t, c) |
| 4827 | - }) |
| 4828 | - |
| 4829 | - // Create |
| 4830 | - var cacheSetting *CacheSetting |
| 4831 | - record(t, "cache_settings/create", func(c *Client) { |
| 4832 | - cacheSetting, err = c.CreateCacheSetting(&CreateCacheSettingInput{ |
| 4833 | - Service: testServiceID, |
| 4834 | - Version: tv.Number, |
| 4835 | - Name: "test-cache-setting", |
| 4836 | - Action: CacheSettingActionCache, |
| 4837 | - TTL: 1234, |
| 4838 | - StaleTTL: 1500, |
| 4839 | - }) |
| 4840 | - }) |
| 4841 | - if err != nil { |
| 4842 | - t.Fatal(err) |
| 4843 | - } |
| 4844 | - |
| 4845 | - // Ensure deleted |
| 4846 | - defer func() { |
| 4847 | - record(t, "cache_settings/cleanup", func(c *Client) { |
| 4848 | - c.DeleteCacheSetting(&DeleteCacheSettingInput{ |
| 4849 | - Service: testServiceID, |
| 4850 | - Version: tv.Number, |
| 4851 | - Name: "test-cache-setting", |
| 4852 | - }) |
| 4853 | - |
| 4854 | - c.DeleteCacheSetting(&DeleteCacheSettingInput{ |
| 4855 | - Service: testServiceID, |
| 4856 | - Version: tv.Number, |
| 4857 | - Name: "new-test-cache-setting", |
| 4858 | - }) |
| 4859 | - }) |
| 4860 | - }() |
| 4861 | - |
| 4862 | - if cacheSetting.Name != "test-cache-setting" { |
| 4863 | - t.Errorf("bad name: %q", cacheSetting.Name) |
| 4864 | - } |
| 4865 | - if cacheSetting.Action != CacheSettingActionCache { |
| 4866 | - t.Errorf("bad action: %q", cacheSetting.Action) |
| 4867 | - } |
| 4868 | - if cacheSetting.TTL != 1234 { |
| 4869 | - t.Errorf("bad ttl: %d", cacheSetting.TTL) |
| 4870 | - } |
| 4871 | - if cacheSetting.StaleTTL != 1500 { |
| 4872 | - t.Errorf("bad stale_ttl: %d", cacheSetting.StaleTTL) |
| 4873 | - } |
| 4874 | - |
| 4875 | - // List |
| 4876 | - var cacheSettings []*CacheSetting |
| 4877 | - record(t, "cache_settings/list", func(c *Client) { |
| 4878 | - cacheSettings, err = c.ListCacheSettings(&ListCacheSettingsInput{ |
| 4879 | - Service: testServiceID, |
| 4880 | - Version: tv.Number, |
| 4881 | - }) |
| 4882 | - }) |
| 4883 | - if err != nil { |
| 4884 | - t.Fatal(err) |
| 4885 | - } |
| 4886 | - if len(cacheSettings) < 1 { |
| 4887 | - t.Errorf("bad cache settings: %v", cacheSettings) |
| 4888 | - } |
| 4889 | - |
| 4890 | - // Get |
| 4891 | - var newCacheSetting *CacheSetting |
| 4892 | - record(t, "cache_settings/get", func(c *Client) { |
| 4893 | - newCacheSetting, err = c.GetCacheSetting(&GetCacheSettingInput{ |
| 4894 | - Service: testServiceID, |
| 4895 | - Version: tv.Number, |
| 4896 | - Name: "test-cache-setting", |
| 4897 | - }) |
| 4898 | - }) |
| 4899 | - if err != nil { |
| 4900 | - t.Fatal(err) |
| 4901 | - } |
| 4902 | - if cacheSetting.Name != newCacheSetting.Name { |
| 4903 | - t.Errorf("bad name: %q (%q)", cacheSetting.Name, newCacheSetting.Name) |
| 4904 | - } |
| 4905 | - if cacheSetting.Action != CacheSettingActionCache { |
| 4906 | - t.Errorf("bad action: %q", cacheSetting.Action) |
| 4907 | - } |
| 4908 | - if cacheSetting.TTL != 1234 { |
| 4909 | - t.Errorf("bad ttl: %d", cacheSetting.TTL) |
| 4910 | - } |
| 4911 | - if cacheSetting.StaleTTL != 1500 { |
| 4912 | - t.Errorf("bad stale_ttl: %d", cacheSetting.StaleTTL) |
| 4913 | - } |
| 4914 | - |
| 4915 | - // Update |
| 4916 | - var updatedCacheSetting *CacheSetting |
| 4917 | - record(t, "cache_settings/update", func(c *Client) { |
| 4918 | - updatedCacheSetting, err = c.UpdateCacheSetting(&UpdateCacheSettingInput{ |
| 4919 | - Service: testServiceID, |
| 4920 | - Version: tv.Number, |
| 4921 | - Name: "test-cache-setting", |
| 4922 | - NewName: "new-test-cache-setting", |
| 4923 | - }) |
| 4924 | - }) |
| 4925 | - if err != nil { |
| 4926 | - t.Fatal(err) |
| 4927 | - } |
| 4928 | - if updatedCacheSetting.Name != "new-test-cache-setting" { |
| 4929 | - t.Errorf("bad name: %q", updatedCacheSetting.Name) |
| 4930 | - } |
| 4931 | - |
| 4932 | - // Delete |
| 4933 | - record(t, "cache_settings/delete", func(c *Client) { |
| 4934 | - err = c.DeleteCacheSetting(&DeleteCacheSettingInput{ |
| 4935 | - Service: testServiceID, |
| 4936 | - Version: tv.Number, |
| 4937 | - Name: "new-test-cache-setting", |
| 4938 | - }) |
| 4939 | - }) |
| 4940 | - if err != nil { |
| 4941 | - t.Fatal(err) |
| 4942 | - } |
| 4943 | } |
| 4944 | |
| 4945 | func TestClient_ListCacheSettings_validation(t *testing.T) { |
| 4946 | Index: golang-github-sethvargo-go-fastly/fastly/condition_test.go |
| 4947 | =================================================================== |
| 4948 | --- golang-github-sethvargo-go-fastly.orig/fastly/condition_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 4949 | +++ golang-github-sethvargo-go-fastly/fastly/condition_test.go 2019-08-22 14:11:55.578363666 +0000 |
| 4950 | @@ -3,122 +3,6 @@ |
| 4951 | import "testing" |
| 4952 | |
| 4953 | func TestClient_Conditions(t *testing.T) { |
| 4954 | - t.Parallel() |
| 4955 | - |
| 4956 | - var err error |
| 4957 | - var tv *Version |
| 4958 | - record(t, "conditions/version", func(c *Client) { |
| 4959 | - tv = testVersion(t, c) |
| 4960 | - }) |
| 4961 | - |
| 4962 | - // Create |
| 4963 | - var condition *Condition |
| 4964 | - record(t, "conditions/create", func(c *Client) { |
| 4965 | - condition, err = c.CreateCondition(&CreateConditionInput{ |
| 4966 | - Service: testServiceID, |
| 4967 | - Version: tv.Number, |
| 4968 | - Name: "test/condition", |
| 4969 | - Statement: "req.url~+\"index.html\"", |
| 4970 | - Type: "REQUEST", |
| 4971 | - Priority: 1, |
| 4972 | - }) |
| 4973 | - }) |
| 4974 | - if err != nil { |
| 4975 | - t.Fatal(err) |
| 4976 | - } |
| 4977 | - |
| 4978 | - // // Ensure deleted |
| 4979 | - defer func() { |
| 4980 | - record(t, "conditions/cleanup", func(c *Client) { |
| 4981 | - c.DeleteCondition(&DeleteConditionInput{ |
| 4982 | - Service: testServiceID, |
| 4983 | - Version: tv.Number, |
| 4984 | - Name: "test/condition", |
| 4985 | - }) |
| 4986 | - }) |
| 4987 | - }() |
| 4988 | - |
| 4989 | - if condition.Name != "test/condition" { |
| 4990 | - t.Errorf("bad name: %q", condition.Name) |
| 4991 | - } |
| 4992 | - if condition.Statement != "req.url~+\"index.html\"" { |
| 4993 | - t.Errorf("bad statement: %q", condition.Statement) |
| 4994 | - } |
| 4995 | - if condition.Type != "REQUEST" { |
| 4996 | - t.Errorf("bad type: %s", condition.Type) |
| 4997 | - } |
| 4998 | - if condition.Priority != 1 { |
| 4999 | - t.Errorf("bad priority: %d", condition.Priority) |
| 5000 | - } |
| 5001 | - |
| 5002 | - // List |
| 5003 | - var conditions []*Condition |
| 5004 | - record(t, "conditions/list", func(c *Client) { |
| 5005 | - conditions, err = c.ListConditions(&ListConditionsInput{ |
| 5006 | - Service: testServiceID, |
| 5007 | - Version: tv.Number, |
| 5008 | - }) |
| 5009 | - }) |
| 5010 | - if err != nil { |
| 5011 | - t.Fatal(err) |
| 5012 | - } |
| 5013 | - if len(conditions) < 1 { |
| 5014 | - t.Errorf("bad conditions: %v", conditions) |
| 5015 | - } |
| 5016 | - |
| 5017 | - // Get |
| 5018 | - var newCondition *Condition |
| 5019 | - record(t, "conditions/get", func(c *Client) { |
| 5020 | - newCondition, err = c.GetCondition(&GetConditionInput{ |
| 5021 | - Service: testServiceID, |
| 5022 | - Version: tv.Number, |
| 5023 | - Name: "test/condition", |
| 5024 | - }) |
| 5025 | - }) |
| 5026 | - if err != nil { |
| 5027 | - t.Fatal(err) |
| 5028 | - } |
| 5029 | - if condition.Name != newCondition.Name { |
| 5030 | - t.Errorf("bad name: %q (%q)", condition.Name, newCondition.Name) |
| 5031 | - } |
| 5032 | - if condition.Statement != "req.url~+\"index.html\"" { |
| 5033 | - t.Errorf("bad statement: %q", condition.Statement) |
| 5034 | - } |
| 5035 | - if condition.Type != "REQUEST" { |
| 5036 | - t.Errorf("bad type: %s", condition.Type) |
| 5037 | - } |
| 5038 | - if condition.Priority != 1 { |
| 5039 | - t.Errorf("bad priority: %d", condition.Priority) |
| 5040 | - } |
| 5041 | - |
| 5042 | - // Update |
| 5043 | - var updatedCondition *Condition |
| 5044 | - record(t, "conditions/update", func(c *Client) { |
| 5045 | - updatedCondition, err = c.UpdateCondition(&UpdateConditionInput{ |
| 5046 | - Service: testServiceID, |
| 5047 | - Version: tv.Number, |
| 5048 | - Name: "test/condition", |
| 5049 | - Statement: "req.url~+\"updated.html\"", |
| 5050 | - }) |
| 5051 | - }) |
| 5052 | - if err != nil { |
| 5053 | - t.Fatal(err) |
| 5054 | - } |
| 5055 | - if updatedCondition.Statement != "req.url~+\"updated.html\"" { |
| 5056 | - t.Errorf("bad statement: %q", updatedCondition.Statement) |
| 5057 | - } |
| 5058 | - |
| 5059 | - // Delete |
| 5060 | - record(t, "conditions/delete", func(c *Client) { |
| 5061 | - err = c.DeleteCondition(&DeleteConditionInput{ |
| 5062 | - Service: testServiceID, |
| 5063 | - Version: tv.Number, |
| 5064 | - Name: "test/condition", |
| 5065 | - }) |
| 5066 | - }) |
| 5067 | - if err != nil { |
| 5068 | - t.Fatal(err) |
| 5069 | - } |
| 5070 | } |
| 5071 | |
| 5072 | func TestClient_ListConditions_validation(t *testing.T) { |
| 5073 | Index: golang-github-sethvargo-go-fastly/fastly/content_test.go |
| 5074 | =================================================================== |
| 5075 | --- golang-github-sethvargo-go-fastly.orig/fastly/content_test.go 2019-08-21 23:08:10.829969976 +0000 |
| 5076 | +++ golang-github-sethvargo-go-fastly/fastly/content_test.go 2019-08-22 14:10:08.101584560 +0000 |
| 5077 | @@ -3,19 +3,4 @@ |
| 5078 | import "testing" |
| 5079 | |
| 5080 | func TestClient_EdgeCheck(t *testing.T) { |
| 5081 | - t.Parallel() |
| 5082 | - |
| 5083 | - var err error |
| 5084 | - var edges []*EdgeCheck |
| 5085 | - record(t, "content/check", func(c *Client) { |
| 5086 | - edges, err = c.EdgeCheck(&EdgeCheckInput{ |
| 5087 | - URL: "releases.hashicorp.com", |
| 5088 | - }) |
| 5089 | - }) |
| 5090 | - if err != nil { |
| 5091 | - t.Fatal(err) |
| 5092 | - } |
| 5093 | - if len(edges) < 1 { |
| 5094 | - t.Errorf("bad edge check: %d", len(edges)) |
| 5095 | - } |
| 5096 | } |
| 5097 | Index: golang-github-sethvargo-go-fastly/fastly/dictionary_test.go |
| 5098 | =================================================================== |
| 5099 | --- golang-github-sethvargo-go-fastly.orig/fastly/dictionary_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 5100 | +++ golang-github-sethvargo-go-fastly/fastly/dictionary_test.go 2019-08-22 14:11:21.996870414 +0000 |
| 5101 | @@ -3,106 +3,6 @@ |
| 5102 | import "testing" |
| 5103 | |
| 5104 | func TestClient_Dictionaries(t *testing.T) { |
| 5105 | - t.Parallel() |
| 5106 | - |
| 5107 | - fixtureBase := "dictionaries/" |
| 5108 | - |
| 5109 | - testVersion := createTestVersion(t, fixtureBase+"version", testServiceID) |
| 5110 | - |
| 5111 | - // Create |
| 5112 | - var err error |
| 5113 | - var d *Dictionary |
| 5114 | - record(t, fixtureBase+"create", func(c *Client) { |
| 5115 | - d, err = c.CreateDictionary(&CreateDictionaryInput{ |
| 5116 | - Service: testServiceID, |
| 5117 | - Version: testVersion.Number, |
| 5118 | - Name: "test_dictionary", |
| 5119 | - }) |
| 5120 | - }) |
| 5121 | - if err != nil { |
| 5122 | - t.Fatal(err) |
| 5123 | - } |
| 5124 | - |
| 5125 | - // Ensure deleted |
| 5126 | - defer func() { |
| 5127 | - record(t, fixtureBase+"cleanup", func(c *Client) { |
| 5128 | - c.DeleteDictionary(&DeleteDictionaryInput{ |
| 5129 | - Service: testServiceID, |
| 5130 | - Version: testVersion.Number, |
| 5131 | - Name: "test_dictionary", |
| 5132 | - }) |
| 5133 | - |
| 5134 | - c.DeleteDictionary(&DeleteDictionaryInput{ |
| 5135 | - Service: testServiceID, |
| 5136 | - Version: testVersion.Number, |
| 5137 | - Name: "new_test_dictionary", |
| 5138 | - }) |
| 5139 | - }) |
| 5140 | - }() |
| 5141 | - |
| 5142 | - if d.Name != "test_dictionary" { |
| 5143 | - t.Errorf("bad name: %q", d.Name) |
| 5144 | - } |
| 5145 | - |
| 5146 | - // List |
| 5147 | - var ds []*Dictionary |
| 5148 | - record(t, fixtureBase+"list", func(c *Client) { |
| 5149 | - ds, err = c.ListDictionaries(&ListDictionariesInput{ |
| 5150 | - Service: testServiceID, |
| 5151 | - Version: testVersion.Number, |
| 5152 | - }) |
| 5153 | - }) |
| 5154 | - if err != nil { |
| 5155 | - t.Fatal(err) |
| 5156 | - } |
| 5157 | - if len(ds) < 1 { |
| 5158 | - t.Errorf("bad dictionaries: %v", ds) |
| 5159 | - } |
| 5160 | - |
| 5161 | - // Get |
| 5162 | - var nd *Dictionary |
| 5163 | - record(t, fixtureBase+"get", func(c *Client) { |
| 5164 | - nd, err = c.GetDictionary(&GetDictionaryInput{ |
| 5165 | - Service: testServiceID, |
| 5166 | - Version: testVersion.Number, |
| 5167 | - Name: "test_dictionary", |
| 5168 | - }) |
| 5169 | - }) |
| 5170 | - if err != nil { |
| 5171 | - t.Fatal(err) |
| 5172 | - } |
| 5173 | - if d.Name != nd.Name { |
| 5174 | - t.Errorf("bad name: %q (%q)", d.Name, nd.Name) |
| 5175 | - } |
| 5176 | - |
| 5177 | - // Update |
| 5178 | - var ud *Dictionary |
| 5179 | - record(t, fixtureBase+"update", func(c *Client) { |
| 5180 | - ud, err = c.UpdateDictionary(&UpdateDictionaryInput{ |
| 5181 | - Service: testServiceID, |
| 5182 | - Version: testVersion.Number, |
| 5183 | - Name: "test_dictionary", |
| 5184 | - NewName: "new_test_dictionary", |
| 5185 | - }) |
| 5186 | - }) |
| 5187 | - if err != nil { |
| 5188 | - t.Fatal(err) |
| 5189 | - } |
| 5190 | - if ud.Name != "new_test_dictionary" { |
| 5191 | - t.Errorf("bad name: %q", ud.Name) |
| 5192 | - } |
| 5193 | - |
| 5194 | - // Delete |
| 5195 | - record(t, fixtureBase+"delete", func(c *Client) { |
| 5196 | - err = c.DeleteDictionary(&DeleteDictionaryInput{ |
| 5197 | - Service: testServiceID, |
| 5198 | - Version: testVersion.Number, |
| 5199 | - Name: "new_test_dictionary", |
| 5200 | - }) |
| 5201 | - }) |
| 5202 | - if err != nil { |
| 5203 | - t.Fatal(err) |
| 5204 | - } |
| 5205 | } |
| 5206 | |
| 5207 | func TestClient_ListDictionaries_validation(t *testing.T) { |
| 5208 | Index: golang-github-sethvargo-go-fastly/fastly/diff_test.go |
| 5209 | =================================================================== |
| 5210 | --- golang-github-sethvargo-go-fastly.orig/fastly/diff_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 5211 | +++ golang-github-sethvargo-go-fastly/fastly/diff_test.go 2019-08-22 14:10:51.163499360 +0000 |
| 5212 | @@ -3,70 +3,6 @@ |
| 5213 | import "testing" |
| 5214 | |
| 5215 | func TestClient_Diff(t *testing.T) { |
| 5216 | - t.Parallel() |
| 5217 | - |
| 5218 | - var err error |
| 5219 | - var tv1 *Version |
| 5220 | - record(t, "diff/version_1", func(c *Client) { |
| 5221 | - tv1 = testVersion(t, c) |
| 5222 | - }) |
| 5223 | - |
| 5224 | - var tv2 *Version |
| 5225 | - record(t, "diff/version_2", func(c *Client) { |
| 5226 | - tv2 = testVersion(t, c) |
| 5227 | - }) |
| 5228 | - |
| 5229 | - // Diff should be empty |
| 5230 | - var d *Diff |
| 5231 | - record(t, "diff/get", func(c *Client) { |
| 5232 | - d, err = c.GetDiff(&GetDiffInput{ |
| 5233 | - Service: testServiceID, |
| 5234 | - From: tv1.Number, |
| 5235 | - To: tv2.Number, |
| 5236 | - }) |
| 5237 | - }) |
| 5238 | - if err != nil { |
| 5239 | - t.Fatal(err) |
| 5240 | - } |
| 5241 | - |
| 5242 | - // Create a diff |
| 5243 | - record(t, "diff/create_backend", func(c *Client) { |
| 5244 | - _, err = c.CreateBackend(&CreateBackendInput{ |
| 5245 | - Service: testServiceID, |
| 5246 | - Version: tv2.Number, |
| 5247 | - Name: "test-backend", |
| 5248 | - Address: "integ-test.go-fastly.com", |
| 5249 | - }) |
| 5250 | - }) |
| 5251 | - if err != nil { |
| 5252 | - t.Fatal(err) |
| 5253 | - } |
| 5254 | - |
| 5255 | - // Ensure we delete the backend we just created |
| 5256 | - defer func() { |
| 5257 | - record(t, "diff/cleanup", func(c *Client) { |
| 5258 | - c.DeleteBackend(&DeleteBackendInput{ |
| 5259 | - Service: testServiceID, |
| 5260 | - Version: tv2.Number, |
| 5261 | - Name: "test-backend", |
| 5262 | - }) |
| 5263 | - }) |
| 5264 | - }() |
| 5265 | - |
| 5266 | - // Diff should mot be empty |
| 5267 | - record(t, "diff/get_again", func(c *Client) { |
| 5268 | - d, err = c.GetDiff(&GetDiffInput{ |
| 5269 | - Service: testServiceID, |
| 5270 | - From: tv1.Number, |
| 5271 | - To: tv2.Number, |
| 5272 | - }) |
| 5273 | - }) |
| 5274 | - if err != nil { |
| 5275 | - t.Fatal(err) |
| 5276 | - } |
| 5277 | - if len(d.Diff) == 0 { |
| 5278 | - t.Errorf("bad diff: %s", d.Diff) |
| 5279 | - } |
| 5280 | } |
| 5281 | |
| 5282 | func TestClient_Diff_validation(t *testing.T) { |
| 5283 | Index: golang-github-sethvargo-go-fastly/fastly/director_backend_test.go |
| 5284 | =================================================================== |
| 5285 | --- golang-github-sethvargo-go-fastly.orig/fastly/director_backend_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 5286 | +++ golang-github-sethvargo-go-fastly/fastly/director_backend_test.go 2019-08-22 14:08:13.936508044 +0000 |
| 5287 | @@ -3,80 +3,6 @@ |
| 5288 | import "testing" |
| 5289 | |
| 5290 | func TestClient_DirectorBackends(t *testing.T) { |
| 5291 | - t.Parallel() |
| 5292 | - |
| 5293 | - var err error |
| 5294 | - var tv *Version |
| 5295 | - record(t, "director_backends/version", func(c *Client) { |
| 5296 | - tv = testVersion(t, c) |
| 5297 | - }) |
| 5298 | - |
| 5299 | - // Create |
| 5300 | - var b *DirectorBackend |
| 5301 | - record(t, "director_backends/create", func(c *Client) { |
| 5302 | - b, err = c.CreateDirectorBackend(&CreateDirectorBackendInput{ |
| 5303 | - Service: testServiceID, |
| 5304 | - Version: tv.Number, |
| 5305 | - Director: "director", |
| 5306 | - Backend: "backend", |
| 5307 | - }) |
| 5308 | - }) |
| 5309 | - if err != nil { |
| 5310 | - t.Fatal(err) |
| 5311 | - } |
| 5312 | - |
| 5313 | - // Ensure deleted |
| 5314 | - defer func() { |
| 5315 | - record(t, "director_backends/cleanup", func(c *Client) { |
| 5316 | - c.DeleteDirectorBackend(&DeleteDirectorBackendInput{ |
| 5317 | - Service: testServiceID, |
| 5318 | - Version: tv.Number, |
| 5319 | - Director: "director", |
| 5320 | - Backend: "backend", |
| 5321 | - }) |
| 5322 | - }) |
| 5323 | - }() |
| 5324 | - |
| 5325 | - if b.Director != "director" { |
| 5326 | - t.Errorf("bad director: %q", b.Director) |
| 5327 | - } |
| 5328 | - if b.Backend != "backend" { |
| 5329 | - t.Errorf("bad backend: %q", b.Backend) |
| 5330 | - } |
| 5331 | - |
| 5332 | - // Get |
| 5333 | - var nb *DirectorBackend |
| 5334 | - record(t, "director_backends/get", func(c *Client) { |
| 5335 | - nb, err = c.GetDirectorBackend(&GetDirectorBackendInput{ |
| 5336 | - Service: testServiceID, |
| 5337 | - Version: tv.Number, |
| 5338 | - Director: "director", |
| 5339 | - Backend: "backend", |
| 5340 | - }) |
| 5341 | - }) |
| 5342 | - if err != nil { |
| 5343 | - t.Fatal(err) |
| 5344 | - } |
| 5345 | - |
| 5346 | - if b.Director != nb.Director { |
| 5347 | - t.Errorf("bad director: %q", b.Director) |
| 5348 | - } |
| 5349 | - if b.Backend != nb.Backend { |
| 5350 | - t.Errorf("bad backend: %q", b.Backend) |
| 5351 | - } |
| 5352 | - |
| 5353 | - // Delete |
| 5354 | - record(t, "director_backends/delete", func(c *Client) { |
| 5355 | - err = c.DeleteDirectorBackend(&DeleteDirectorBackendInput{ |
| 5356 | - Service: testServiceID, |
| 5357 | - Version: tv.Number, |
| 5358 | - Director: "director", |
| 5359 | - Backend: "backend", |
| 5360 | - }) |
| 5361 | - }) |
| 5362 | - if err != nil { |
| 5363 | - t.Fatal(err) |
| 5364 | - } |
| 5365 | } |
| 5366 | |
| 5367 | func TestClient_CreateDirectorBackend_validation(t *testing.T) { |
| 5368 | Index: golang-github-sethvargo-go-fastly/fastly/domain_test.go |
| 5369 | =================================================================== |
| 5370 | --- golang-github-sethvargo-go-fastly.orig/fastly/domain_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 5371 | +++ golang-github-sethvargo-go-fastly/fastly/domain_test.go 2019-08-22 14:09:40.336349932 +0000 |
| 5372 | @@ -3,114 +3,6 @@ |
| 5373 | import "testing" |
| 5374 | |
| 5375 | func TestClient_Domains(t *testing.T) { |
| 5376 | - t.Parallel() |
| 5377 | - |
| 5378 | - var err error |
| 5379 | - var tv *Version |
| 5380 | - record(t, "domains/version", func(c *Client) { |
| 5381 | - tv = testVersion(t, c) |
| 5382 | - }) |
| 5383 | - |
| 5384 | - // Create |
| 5385 | - var d *Domain |
| 5386 | - record(t, "domains/create", func(c *Client) { |
| 5387 | - d, err = c.CreateDomain(&CreateDomainInput{ |
| 5388 | - Service: testServiceID, |
| 5389 | - Version: tv.Number, |
| 5390 | - Name: "integ-test.go-fastly.com", |
| 5391 | - Comment: "comment", |
| 5392 | - }) |
| 5393 | - }) |
| 5394 | - if err != nil { |
| 5395 | - t.Fatal(err) |
| 5396 | - } |
| 5397 | - |
| 5398 | - // Ensure deleted |
| 5399 | - defer func() { |
| 5400 | - record(t, "domains/cleanup", func(c *Client) { |
| 5401 | - c.DeleteDomain(&DeleteDomainInput{ |
| 5402 | - Service: testServiceID, |
| 5403 | - Version: tv.Number, |
| 5404 | - Name: "integ-test.go-fastly.com", |
| 5405 | - }) |
| 5406 | - |
| 5407 | - c.DeleteDomain(&DeleteDomainInput{ |
| 5408 | - Service: testServiceID, |
| 5409 | - Version: tv.Number, |
| 5410 | - Name: "new-integ-test.go-fastly.com", |
| 5411 | - }) |
| 5412 | - }) |
| 5413 | - }() |
| 5414 | - |
| 5415 | - if d.Name != "integ-test.go-fastly.com" { |
| 5416 | - t.Errorf("bad name: %q", d.Name) |
| 5417 | - } |
| 5418 | - if d.Comment != "comment" { |
| 5419 | - t.Errorf("bad comment: %q", d.Comment) |
| 5420 | - } |
| 5421 | - |
| 5422 | - // List |
| 5423 | - var ds []*Domain |
| 5424 | - record(t, "domains/list", func(c *Client) { |
| 5425 | - ds, err = c.ListDomains(&ListDomainsInput{ |
| 5426 | - Service: testServiceID, |
| 5427 | - Version: tv.Number, |
| 5428 | - }) |
| 5429 | - }) |
| 5430 | - if err != nil { |
| 5431 | - t.Fatal(err) |
| 5432 | - } |
| 5433 | - if len(ds) < 1 { |
| 5434 | - t.Errorf("bad domains: %v", ds) |
| 5435 | - } |
| 5436 | - |
| 5437 | - // Get |
| 5438 | - var nd *Domain |
| 5439 | - record(t, "domains/get", func(c *Client) { |
| 5440 | - nd, err = c.GetDomain(&GetDomainInput{ |
| 5441 | - Service: testServiceID, |
| 5442 | - Version: tv.Number, |
| 5443 | - Name: "integ-test.go-fastly.com", |
| 5444 | - }) |
| 5445 | - }) |
| 5446 | - if err != nil { |
| 5447 | - t.Fatal(err) |
| 5448 | - } |
| 5449 | - if d.Name != nd.Name { |
| 5450 | - t.Errorf("bad name: %q (%q)", d.Name, nd.Name) |
| 5451 | - } |
| 5452 | - if d.Comment != nd.Comment { |
| 5453 | - t.Errorf("bad comment: %q (%q)", d.Comment, nd.Comment) |
| 5454 | - } |
| 5455 | - |
| 5456 | - // Update |
| 5457 | - var ud *Domain |
| 5458 | - record(t, "domains/update", func(c *Client) { |
| 5459 | - ud, err = c.UpdateDomain(&UpdateDomainInput{ |
| 5460 | - Service: testServiceID, |
| 5461 | - Version: tv.Number, |
| 5462 | - Name: "integ-test.go-fastly.com", |
| 5463 | - NewName: "new-integ-test.go-fastly.com", |
| 5464 | - }) |
| 5465 | - }) |
| 5466 | - if err != nil { |
| 5467 | - t.Fatal(err) |
| 5468 | - } |
| 5469 | - if ud.Name != "new-integ-test.go-fastly.com" { |
| 5470 | - t.Errorf("bad name: %q", ud.Name) |
| 5471 | - } |
| 5472 | - |
| 5473 | - // Delete |
| 5474 | - record(t, "domains/delete", func(c *Client) { |
| 5475 | - err = c.DeleteDomain(&DeleteDomainInput{ |
| 5476 | - Service: testServiceID, |
| 5477 | - Version: tv.Number, |
| 5478 | - Name: "new-integ-test.go-fastly.com", |
| 5479 | - }) |
| 5480 | - }) |
| 5481 | - if err != nil { |
| 5482 | - t.Fatal(err) |
| 5483 | - } |
| 5484 | } |
| 5485 | |
| 5486 | func TestClient_ListDomains_validation(t *testing.T) { |
| 5487 | Index: golang-github-sethvargo-go-fastly/fastly/ftp_test.go |
| 5488 | =================================================================== |
| 5489 | --- golang-github-sethvargo-go-fastly.orig/fastly/ftp_test.go 2019-08-21 23:08:10.885972466 +0000 |
| 5490 | +++ golang-github-sethvargo-go-fastly/fastly/ftp_test.go 2019-08-22 14:09:12.415108372 +0000 |
| 5491 | @@ -3,184 +3,6 @@ |
| 5492 | import "testing" |
| 5493 | |
| 5494 | func TestClient_FTPs(t *testing.T) { |
| 5495 | - t.Parallel() |
| 5496 | - |
| 5497 | - var err error |
| 5498 | - var tv *Version |
| 5499 | - record(t, "ftps/version", func(c *Client) { |
| 5500 | - tv = testVersion(t, c) |
| 5501 | - }) |
| 5502 | - |
| 5503 | - // Create |
| 5504 | - var ftp *FTP |
| 5505 | - record(t, "ftps/create", func(c *Client) { |
| 5506 | - ftp, err = c.CreateFTP(&CreateFTPInput{ |
| 5507 | - Service: testServiceID, |
| 5508 | - Version: tv.Number, |
| 5509 | - Name: "test-ftp", |
| 5510 | - Address: "example.com", |
| 5511 | - Port: 1234, |
| 5512 | - Username: "username", |
| 5513 | - Password: "password", |
| 5514 | - Path: "/dir", |
| 5515 | - Period: 12, |
| 5516 | - GzipLevel: 9, |
| 5517 | - FormatVersion: 2, |
| 5518 | - Format: "format", |
| 5519 | - TimestampFormat: "%Y", |
| 5520 | - Placement: "waf_debug", |
| 5521 | - }) |
| 5522 | - }) |
| 5523 | - if err != nil { |
| 5524 | - t.Fatal(err) |
| 5525 | - } |
| 5526 | - |
| 5527 | - // Ensure deleted |
| 5528 | - defer func() { |
| 5529 | - record(t, "ftps/cleanup", func(c *Client) { |
| 5530 | - c.DeleteFTP(&DeleteFTPInput{ |
| 5531 | - Service: testServiceID, |
| 5532 | - Version: tv.Number, |
| 5533 | - Name: "test-ftp", |
| 5534 | - }) |
| 5535 | - |
| 5536 | - c.DeleteFTP(&DeleteFTPInput{ |
| 5537 | - Service: testServiceID, |
| 5538 | - Version: tv.Number, |
| 5539 | - Name: "new-test-ftp", |
| 5540 | - }) |
| 5541 | - }) |
| 5542 | - }() |
| 5543 | - |
| 5544 | - if ftp.Name != "test-ftp" { |
| 5545 | - t.Errorf("bad name: %q", ftp.Name) |
| 5546 | - } |
| 5547 | - if ftp.Address != "example.com" { |
| 5548 | - t.Errorf("bad address: %q", ftp.Address) |
| 5549 | - } |
| 5550 | - if ftp.Port != 1234 { |
| 5551 | - t.Errorf("bad port: %q", ftp.Port) |
| 5552 | - } |
| 5553 | - if ftp.Username != "username" { |
| 5554 | - t.Errorf("bad username: %q", ftp.Username) |
| 5555 | - } |
| 5556 | - if ftp.Password != "password" { |
| 5557 | - t.Errorf("bad password: %q", ftp.Password) |
| 5558 | - } |
| 5559 | - if ftp.Path != "/dir" { |
| 5560 | - t.Errorf("bad path: %q", ftp.Path) |
| 5561 | - } |
| 5562 | - if ftp.Period != 12 { |
| 5563 | - t.Errorf("bad period: %q", ftp.Period) |
| 5564 | - } |
| 5565 | - if ftp.GzipLevel != 9 { |
| 5566 | - t.Errorf("bad gzip_level: %q", ftp.GzipLevel) |
| 5567 | - } |
| 5568 | - if ftp.FormatVersion != 2 { |
| 5569 | - t.Errorf("bad format_version: %q", ftp.FormatVersion) |
| 5570 | - } |
| 5571 | - if ftp.Format != "format" { |
| 5572 | - t.Errorf("bad format: %q", ftp.Format) |
| 5573 | - } |
| 5574 | - if ftp.TimestampFormat != "%Y" { |
| 5575 | - t.Errorf("bad timestamp_format: %q", ftp.TimestampFormat) |
| 5576 | - } |
| 5577 | - if ftp.Placement != "waf_debug" { |
| 5578 | - t.Errorf("bad placement: %q", ftp.Placement) |
| 5579 | - } |
| 5580 | - |
| 5581 | - // List |
| 5582 | - var ftps []*FTP |
| 5583 | - record(t, "ftps/list", func(c *Client) { |
| 5584 | - ftps, err = c.ListFTPs(&ListFTPsInput{ |
| 5585 | - Service: testServiceID, |
| 5586 | - Version: tv.Number, |
| 5587 | - }) |
| 5588 | - }) |
| 5589 | - if err != nil { |
| 5590 | - t.Fatal(err) |
| 5591 | - } |
| 5592 | - if len(ftps) < 1 { |
| 5593 | - t.Errorf("bad ftps: %v", ftps) |
| 5594 | - } |
| 5595 | - |
| 5596 | - // Get |
| 5597 | - var nftp *FTP |
| 5598 | - record(t, "ftps/get", func(c *Client) { |
| 5599 | - nftp, err = c.GetFTP(&GetFTPInput{ |
| 5600 | - Service: testServiceID, |
| 5601 | - Version: tv.Number, |
| 5602 | - Name: "test-ftp", |
| 5603 | - }) |
| 5604 | - }) |
| 5605 | - if err != nil { |
| 5606 | - t.Fatal(err) |
| 5607 | - } |
| 5608 | - if ftp.Name != nftp.Name { |
| 5609 | - t.Errorf("bad name: %q", ftp.Name) |
| 5610 | - } |
| 5611 | - if ftp.Address != nftp.Address { |
| 5612 | - t.Errorf("bad address: %q", ftp.Address) |
| 5613 | - } |
| 5614 | - if ftp.Port != nftp.Port { |
| 5615 | - t.Errorf("bad port: %q", ftp.Port) |
| 5616 | - } |
| 5617 | - if ftp.Username != nftp.Username { |
| 5618 | - t.Errorf("bad username: %q", ftp.Username) |
| 5619 | - } |
| 5620 | - if ftp.Password != nftp.Password { |
| 5621 | - t.Errorf("bad password: %q", ftp.Password) |
| 5622 | - } |
| 5623 | - if ftp.Path != nftp.Path { |
| 5624 | - t.Errorf("bad path: %q", ftp.Path) |
| 5625 | - } |
| 5626 | - if ftp.Period != nftp.Period { |
| 5627 | - t.Errorf("bad period: %q", ftp.Period) |
| 5628 | - } |
| 5629 | - if ftp.GzipLevel != nftp.GzipLevel { |
| 5630 | - t.Errorf("bad gzip_level: %q", ftp.GzipLevel) |
| 5631 | - } |
| 5632 | - if ftp.FormatVersion != nftp.FormatVersion { |
| 5633 | - t.Errorf("bad format_version: %q", ftp.FormatVersion) |
| 5634 | - } |
| 5635 | - if ftp.Format != nftp.Format { |
| 5636 | - t.Errorf("bad format: %q", ftp.Format) |
| 5637 | - } |
| 5638 | - if ftp.TimestampFormat != nftp.TimestampFormat { |
| 5639 | - t.Errorf("bad timestamp_format: %q", ftp.TimestampFormat) |
| 5640 | - } |
| 5641 | - if ftp.Placement != nftp.Placement { |
| 5642 | - t.Errorf("bad placement: %q", ftp.Placement) |
| 5643 | - } |
| 5644 | - |
| 5645 | - // Update |
| 5646 | - var uftp *FTP |
| 5647 | - record(t, "ftps/update", func(c *Client) { |
| 5648 | - uftp, err = c.UpdateFTP(&UpdateFTPInput{ |
| 5649 | - Service: testServiceID, |
| 5650 | - Version: tv.Number, |
| 5651 | - Name: "test-ftp", |
| 5652 | - NewName: "new-test-ftp", |
| 5653 | - }) |
| 5654 | - }) |
| 5655 | - if err != nil { |
| 5656 | - t.Fatal(err) |
| 5657 | - } |
| 5658 | - if uftp.Name != "new-test-ftp" { |
| 5659 | - t.Errorf("bad name: %q", uftp.Name) |
| 5660 | - } |
| 5661 | - |
| 5662 | - // Delete |
| 5663 | - record(t, "ftps/delete", func(c *Client) { |
| 5664 | - err = c.DeleteFTP(&DeleteFTPInput{ |
| 5665 | - Service: testServiceID, |
| 5666 | - Version: tv.Number, |
| 5667 | - Name: "new-test-ftp", |
| 5668 | - }) |
| 5669 | - }) |
| 5670 | - if err != nil { |
| 5671 | - t.Fatal(err) |
| 5672 | - } |
| 5673 | } |
| 5674 | |
| 5675 | func TestClient_ListFTPs_validation(t *testing.T) { |
| 5676 | Index: golang-github-sethvargo-go-fastly/fastly/director_test.go |
| 5677 | =================================================================== |
| 5678 | --- golang-github-sethvargo-go-fastly.orig/fastly/director_test.go 2019-08-21 23:08:10.833970154 +0000 |
| 5679 | +++ golang-github-sethvargo-go-fastly/fastly/director_test.go 2019-08-22 14:15:26.167727828 +0000 |
| 5680 | @@ -3,129 +3,6 @@ |
| 5681 | import "testing" |
| 5682 | |
| 5683 | func TestClient_Directors(t *testing.T) { |
| 5684 | - t.Parallel() |
| 5685 | - |
| 5686 | - var err error |
| 5687 | - var tv *Version |
| 5688 | - record(t, "directors/version", func(c *Client) { |
| 5689 | - tv = testVersion(t, c) |
| 5690 | - }) |
| 5691 | - |
| 5692 | - // Create |
| 5693 | - var b *Director |
| 5694 | - record(t, "directors/create", func(c *Client) { |
| 5695 | - b, err = c.CreateDirector(&CreateDirectorInput{ |
| 5696 | - Service: testServiceID, |
| 5697 | - Version: tv.Number, |
| 5698 | - Name: "test-director", |
| 5699 | - Quorum: 50, |
| 5700 | - Type: DirectorTypeRandom, |
| 5701 | - Retries: 5, |
| 5702 | - }) |
| 5703 | - }) |
| 5704 | - if err != nil { |
| 5705 | - t.Fatal(err) |
| 5706 | - } |
| 5707 | - |
| 5708 | - // Ensure deleted |
| 5709 | - defer func() { |
| 5710 | - record(t, "directors/cleanup", func(c *Client) { |
| 5711 | - c.DeleteDirector(&DeleteDirectorInput{ |
| 5712 | - Service: testServiceID, |
| 5713 | - Version: tv.Number, |
| 5714 | - Name: "test-director", |
| 5715 | - }) |
| 5716 | - |
| 5717 | - c.DeleteDirector(&DeleteDirectorInput{ |
| 5718 | - Service: testServiceID, |
| 5719 | - Version: tv.Number, |
| 5720 | - Name: "new-test-director", |
| 5721 | - }) |
| 5722 | - }) |
| 5723 | - }() |
| 5724 | - |
| 5725 | - if b.Name != "test-director" { |
| 5726 | - t.Errorf("bad name: %q", b.Name) |
| 5727 | - } |
| 5728 | - if b.Quorum != 50 { |
| 5729 | - t.Errorf("bad quorum: %q", b.Quorum) |
| 5730 | - } |
| 5731 | - if b.Type != DirectorTypeRandom { |
| 5732 | - t.Errorf("bad type: %d", b.Type) |
| 5733 | - } |
| 5734 | - if b.Retries != 5 { |
| 5735 | - t.Errorf("bad retries: %d", b.Retries) |
| 5736 | - } |
| 5737 | - |
| 5738 | - // List |
| 5739 | - var bs []*Director |
| 5740 | - record(t, "directors/list", func(c *Client) { |
| 5741 | - bs, err = c.ListDirectors(&ListDirectorsInput{ |
| 5742 | - Service: testServiceID, |
| 5743 | - Version: tv.Number, |
| 5744 | - }) |
| 5745 | - }) |
| 5746 | - if err != nil { |
| 5747 | - t.Fatal(err) |
| 5748 | - } |
| 5749 | - if len(bs) < 1 { |
| 5750 | - t.Errorf("bad directors: %v", bs) |
| 5751 | - } |
| 5752 | - |
| 5753 | - // Get |
| 5754 | - var nb *Director |
| 5755 | - record(t, "directors/get", func(c *Client) { |
| 5756 | - nb, err = c.GetDirector(&GetDirectorInput{ |
| 5757 | - Service: testServiceID, |
| 5758 | - Version: tv.Number, |
| 5759 | - Name: "test-director", |
| 5760 | - }) |
| 5761 | - }) |
| 5762 | - if err != nil { |
| 5763 | - t.Fatal(err) |
| 5764 | - } |
| 5765 | - if b.Name != nb.Name { |
| 5766 | - t.Errorf("bad name: %q (%q)", b.Name, nb.Name) |
| 5767 | - } |
| 5768 | - if b.Quorum != nb.Quorum { |
| 5769 | - t.Errorf("bad quorum: %q (%q)", b.Quorum, nb.Quorum) |
| 5770 | - } |
| 5771 | - if b.Type != nb.Type { |
| 5772 | - t.Errorf("bad type: %q (%q)", b.Type, nb.Type) |
| 5773 | - } |
| 5774 | - if b.Retries != nb.Retries { |
| 5775 | - t.Errorf("bad retries: %q (%q)", b.Retries, nb.Retries) |
| 5776 | - } |
| 5777 | - |
| 5778 | - // Update |
| 5779 | - var ub *Director |
| 5780 | - record(t, "directors/update", func(c *Client) { |
| 5781 | - ub, err = c.UpdateDirector(&UpdateDirectorInput{ |
| 5782 | - Service: testServiceID, |
| 5783 | - Version: tv.Number, |
| 5784 | - Name: "test-director", |
| 5785 | - NewName: "new-test-director", |
| 5786 | - Quorum: 100, |
| 5787 | - }) |
| 5788 | - }) |
| 5789 | - if err != nil { |
| 5790 | - t.Fatal(err) |
| 5791 | - } |
| 5792 | - if ub.Quorum != 100 { |
| 5793 | - t.Errorf("bad quorum: %q", ub.Quorum) |
| 5794 | - } |
| 5795 | - |
| 5796 | - // Delete |
| 5797 | - record(t, "directors/delete", func(c *Client) { |
| 5798 | - err = c.DeleteDirector(&DeleteDirectorInput{ |
| 5799 | - Service: testServiceID, |
| 5800 | - Version: tv.Number, |
| 5801 | - Name: "test-director", |
| 5802 | - }) |
| 5803 | - }) |
| 5804 | - if err != nil { |
| 5805 | - t.Fatal(err) |
| 5806 | - } |
| 5807 | } |
| 5808 | |
| 5809 | func TestClient_ListDirectors_validation(t *testing.T) { |