Skip to content

Commit

Permalink
test: fix upstreams test
Browse files Browse the repository at this point in the history
  • Loading branch information
2eha0 committed Aug 2, 2024
1 parent cd888ae commit f52f662
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@kong-ui-public/entities-routes": "^3.2.0",
"@kong-ui-public/entities-shared": "^3.2.0",
"@kong-ui-public/entities-snis": "^3.3.11",
"@kong-ui-public/entities-upstreams-targets": "^3.3.12",
"@kong-ui-public/entities-upstreams-targets": "^3.3.14-pr.1530.c7c5003f.0",
"@kong-ui-public/entities-vaults": "^3.8.3",
"@kong-ui-public/forms": "^4.0.2",
"@kong-ui-public/i18n": "^2.2.2",
Expand Down
82 changes: 41 additions & 41 deletions tests/playwright/specs/upstreams/01-Upstreams.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ test.describe('upstreams', () => {
async () => {
await expect(getPropertyValue(page, 'name')).toHaveText(upstream_host2)
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 0}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": null, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 0}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": null, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)

Expand All @@ -497,11 +497,11 @@ test.describe('upstreams', () => {
{},
async () => {
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 5, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)

Expand All @@ -514,11 +514,11 @@ test.describe('upstreams', () => {
{},
async () => {
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 5, "http_failures": 5}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 5, "timeouts": 5, "http_failures": 5}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 5, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)

Expand All @@ -531,11 +531,11 @@ test.describe('upstreams', () => {
{},
async () => {
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 5, "http_failures": 5}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 5, "timeouts": 5, "http_failures": 5}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 0}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)

Expand All @@ -548,11 +548,11 @@ test.describe('upstreams', () => {
{},
async () => {
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 0, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0, "http_failures": 0}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 0, "http_statuses": [200, 302], "successes": 0}, "unhealthy": {"interval": 0, "tcp_failures": 0, "timeouts": 0, "http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)
})
Expand Down Expand Up @@ -584,11 +584,11 @@ test.describe('upstreams', () => {
async () => {
await expect(getPropertyValue(page, 'name')).toHaveText(upstream_host2)
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 5, "http_failures": 5}}'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{"type": "http", "healthy": {"successes": 80, "http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]}, "unhealthy": {"http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 5, "http_failures": 5}}'))
expect(JSON.parse(active)).toEqual(JSON.parse('{"concurrency": 10, "healthy": {"interval": 5, "http_statuses": [200, 302], "successes": 5}, "unhealthy": {"interval": 5, "tcp_failures": 0, "timeouts": 0, "http_failures": 5, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505]}, "headers": {}, "type": "http", "https_sni": null, "https_verify_certificate": true, "http_path": "/", "timeout": 1}'))
},
)

Expand Down Expand Up @@ -625,11 +625,11 @@ test.describe('upstreams', () => {
},
async () => {
await expect(getPropertyValue(page, 'threshold')).toHaveText('1')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 8, "http_statuses": [ 200 ] }, "type": "http", "unhealthy": { "timeouts": 10, "http_failures": 10, "http_statuses": [ 429, 500, 503, 100, 101 ], "tcp_failures": 0 } }'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{ "headers": { "h1": [ "v1", "v2" ] }, "http_path": "/path", "https_sni": null, "concurrency": 15, "type": "http", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302, 100, 103 ], "successes": 10, "interval": 10 }, "unhealthy": { "timeouts": 10, "http_failures": 10, "http_statuses": [ 404, 429, 500, 501, 502, 503, 504, 505, 100, 101 ], "interval": 10, "tcp_failures": 0 }, "timeout": 5 }'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 8, "http_statuses": [ 200 ] }, "type": "http", "unhealthy": { "timeouts": 10, "http_failures": 10, "http_statuses": [ 429, 500, 503, 100, 101 ], "tcp_failures": 0 } }'))
expect(JSON.parse(active)).toEqual(JSON.parse('{ "headers": { "h1": [ "v1", "v2" ] }, "http_path": "/path", "https_sni": null, "concurrency": 15, "type": "http", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302, 100, 103 ], "successes": 10, "interval": 10 }, "unhealthy": { "timeouts": 10, "http_failures": 10, "http_statuses": [ 404, 429, 500, 501, 502, 503, 504, 505, 100, 101 ], "interval": 10, "tcp_failures": 0 }, "timeout": 5 }'))
},
)
})
Expand Down Expand Up @@ -663,15 +663,15 @@ test.describe('upstreams', () => {
async () => {
await expect(getPropertyValue(page, 'name')).toHaveText(upstream_host2)
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
// if (check_type.ssl) {
// expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "http", "unhealthy": { "timeouts": 5, "http_failures": 5, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 0 } }'))
// expect(JSON.parse(active)).toEqual(JSON.parse(`{ "headers": {}, "http_path": "/", "https_sni": "sni", "concurrency": 10, "type": "${check_type.protocol}", "https_verify_certificate": ${!verify_ssl}, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 5, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 0 }, "timeout": 1 }`))
// } else {
// expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "http", "unhealthy": { "timeouts": 5, "http_failures": 5, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 0 } }'))
// expect(JSON.parse(active)).toEqual(JSON.parse(`{ "headers": {}, "http_path": "/", "https_sni": null, "concurrency": 10, "type": "${check_type.protocol}", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 5, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 0 }, "timeout": 1 }`))
// }
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()
if (check_type.ssl) {
expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "http", "unhealthy": { "timeouts": 5, "http_failures": 5, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 0 } }'))
expect(JSON.parse(active)).toEqual(JSON.parse(`{ "headers": {}, "http_path": "/", "https_sni": "sni", "concurrency": 10, "type": "${check_type.protocol}", "https_verify_certificate": ${!verify_ssl}, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 5, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 0 }, "timeout": 1 }`))

Check failure on line 670 in tests/playwright/specs/upstreams/01-Upstreams.spec.ts

View workflow job for this annotation

GitHub Actions / Build / Run lint

Cannot find name 'verify_ssl'.

Check failure on line 670 in tests/playwright/specs/upstreams/01-Upstreams.spec.ts

View workflow job for this annotation

GitHub Actions / Build / Run lint

Cannot find name 'verify_ssl'.
} else {
expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "http", "unhealthy": { "timeouts": 5, "http_failures": 5, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 0 } }'))
expect(JSON.parse(active)).toEqual(JSON.parse(`{ "headers": {}, "http_path": "/", "https_sni": null, "concurrency": 10, "type": "${check_type.protocol}", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 5, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 0 }, "timeout": 1 }`))
}
},
)
})
Expand All @@ -695,11 +695,11 @@ test.describe('upstreams', () => {
async () => {
await expect(getPropertyValue(page, 'name')).toHaveText(upstream_host2)
await expect(getPropertyValue(page, 'threshold')).toHaveText('0')
// const passive = await getPropertyValue(page, 'passive').innerText()
// const active = await getPropertyValue(page, 'active').innerText()
const passive = await getPropertyValue(page, 'passive').innerText()
const active = await getPropertyValue(page, 'active').innerText()

// expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "tcp", "unhealthy": { "timeouts": 5, "http_failures": 0, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 10 } }'))
// expect(JSON.parse(active)).toEqual(JSON.parse('{ "headers": {}, "http_path": "/", "https_sni": null, "concurrency": 10, "type": "tcp", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 0, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 6 }, "timeout": 1 }'))
expect(JSON.parse(passive)).toEqual(JSON.parse('{ "healthy": { "successes": 80, "http_statuses": [ 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308 ] }, "type": "tcp", "unhealthy": { "timeouts": 5, "http_failures": 0, "http_statuses": [ 429, 500, 503 ], "tcp_failures": 10 } }'))
expect(JSON.parse(active)).toEqual(JSON.parse('{ "headers": {}, "http_path": "/", "https_sni": null, "concurrency": 10, "type": "tcp", "https_verify_certificate": true, "healthy": { "http_statuses": [ 200, 302 ], "successes": 5, "interval": 5 }, "unhealthy": { "timeouts": 0, "http_failures": 0, "http_statuses": [ 429, 404, 500, 501, 502, 503, 504, 505 ], "interval": 5, "tcp_failures": 6 }, "timeout": 1 }'))
},
)
})
Expand Down
Loading

0 comments on commit f52f662

Please sign in to comment.