From 6112a537403c16d5eebe97409cb6aca328ac38b8 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 14:12:22 +0200 Subject: [PATCH 01/67] Add binding expiration tests to SKR tests --- testing/e2e/skr/skr-binding-test/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 54b254b6f1..ba3b4b415c 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -62,6 +62,16 @@ describe('SKR Binding test', function() { await getSecret(secretName, ns); }); + it('Create SKR binding with expiration seconds below the minimum value', async function() { + const expirationSeconds = 10; + try { + kubeconfigFromBinding = await keb.createBinding(options.instanceID, true, expirationSeconds); + expect.fail('Expected the test to fail'); + } catch (err) { + console.log(err); + } + }); + after('Cleanup the resources', async function() { this.timeout(deprovisioningTimeout); if (process.env['SKIP_DEPROVISIONING'] != 'true') { From 843bb6f6a77fa77e884d8a0db1809215a7003639 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 14:45:49 +0200 Subject: [PATCH 02/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index ba3b4b415c..8cf344d0ca 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -15,7 +15,7 @@ const secretName = 'sap-btp-manager'; const ns = 'kyma-system'; describe('SKR Binding test', function() { - globalTimeout += provisioningTimeout + deprovisioningTimeout; +/* globalTimeout += provisioningTimeout + deprovisioningTimeout; this.timeout(globalTimeout); this.slow(slowTime); @@ -23,7 +23,7 @@ describe('SKR Binding test', function() { const options = gatherOptions(); // with default values let kubeconfigFromBinding; - before('Ensure SKR is provisioned', async function() { + before('Ensure SKR is provisioned', async function() { this.timeout(provisioningTimeout); await provisionSKRInstance(options, provisioningTimeout); }); @@ -61,21 +61,21 @@ describe('SKR Binding test', function() { it('Fetch sap-btp-manager secret using binding from Gardener', async function() { await getSecret(secretName, ns); }); - +*/ it('Create SKR binding with expiration seconds below the minimum value', async function() { const expirationSeconds = 10; try { - kubeconfigFromBinding = await keb.createBinding(options.instanceID, true, expirationSeconds); + kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); expect.fail('Expected the test to fail'); } catch (err) { console.log(err); } }); - after('Cleanup the resources', async function() { + /* after('Cleanup the resources', async function() { this.timeout(deprovisioningTimeout); if (process.env['SKIP_DEPROVISIONING'] != 'true') { await deprovisionAndUnregisterSKR(options, deprovisioningTimeout, true); } - }); + });*/ }); From b4991eea1ab5ab102b0829bdbfa2a3645c62817e Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 14:49:25 +0200 Subject: [PATCH 03/67] Pass --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 8cf344d0ca..ccfd157e0d 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -63,7 +63,7 @@ describe('SKR Binding test', function() { }); */ it('Create SKR binding with expiration seconds below the minimum value', async function() { - const expirationSeconds = 10; + const expirationSeconds = 700; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); expect.fail('Expected the test to fail'); From 2f71cffdb894358059bb641dde1db7c174ba2c22 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 14:52:45 +0200 Subject: [PATCH 04/67] Fail --- testing/e2e/skr/skr-binding-test/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index ccfd157e0d..59cee323f6 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -63,12 +63,13 @@ describe('SKR Binding test', function() { }); */ it('Create SKR binding with expiration seconds below the minimum value', async function() { - const expirationSeconds = 700; + const expirationSeconds = 10; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); expect.fail('Expected the test to fail'); } catch (err) { console.log(err); + console.log(kubeconfigFromBinding); } }); From 2fa7f3c11227e143f3072ce4ddcac7e4e8838ea5 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 14:54:32 +0200 Subject: [PATCH 05/67] Fail --- testing/e2e/skr/skr-binding-test/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 59cee323f6..8cf344d0ca 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -69,7 +69,6 @@ describe('SKR Binding test', function() { expect.fail('Expected the test to fail'); } catch (err) { console.log(err); - console.log(kubeconfigFromBinding); } }); From 066455717e9ea481a51aded936b450cfcd72d828 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 15:07:29 +0200 Subject: [PATCH 06/67] Error handling --- testing/e2e/skr/skr-binding-test/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 8cf344d0ca..b79d484789 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -62,14 +62,12 @@ describe('SKR Binding test', function() { await getSecret(secretName, ns); }); */ - it('Create SKR binding with expiration seconds below the minimum value', async function() { + it('Should fail creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 10; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); expect.fail('Expected the test to fail'); - } catch (err) { - console.log(err); - } + } catch (err) { } }); /* after('Cleanup the resources', async function() { From c7afb2a22e1d6ff30783d7c48fb1f64638150b7c Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 15:10:37 +0200 Subject: [PATCH 07/67] Change message --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index b79d484789..8bb25be086 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -62,7 +62,7 @@ describe('SKR Binding test', function() { await getSecret(secretName, ns); }); */ - it('Should fail creation of SKR binding when expiration seconds value is below the minimum value', async function() { + it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 10; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); From 347571c38f5c0eb3c738142a9ba86e81d2dac973 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 15:15:13 +0200 Subject: [PATCH 08/67] Next test --- testing/e2e/skr/skr-binding-test/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 8bb25be086..62da69d121 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -70,6 +70,14 @@ describe('SKR Binding test', function() { } catch (err) { } }); + it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { + const expirationSeconds = 100000; + try { + kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); + expect.fail('Expected the test to fail'); + } catch (err) { } + }); + /* after('Cleanup the resources', async function() { this.timeout(deprovisioningTimeout); if (process.env['SKIP_DEPROVISIONING'] != 'true') { From 7d4d4af6607668e559638b5f8895989ef7a3f5c7 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 15:19:08 +0200 Subject: [PATCH 09/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 62da69d121..345d25230f 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -71,7 +71,7 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { - const expirationSeconds = 100000; + const expirationSeconds = 700; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); expect.fail('Expected the test to fail'); From dac43ef88429545fafa3ad1f6e75472fa670fe31 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 15:44:18 +0200 Subject: [PATCH 10/67] Logs --- testing/e2e/skr/skr-binding-test/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 345d25230f..bfc5859313 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,7 +66,8 @@ describe('SKR Binding test', function() { const expirationSeconds = 10; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); - expect.fail('Expected the test to fail'); + console.log("The test was expected to fail but it passed"); + expect.fail(); } catch (err) { } }); @@ -74,7 +75,8 @@ describe('SKR Binding test', function() { const expirationSeconds = 700; try { kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); - expect.fail('Expected the test to fail'); + console.log("The test was expected to fail but it passed"); + expect.fail(); } catch (err) { } }); From a3c7a471da57a31c117bc834fdc159668d4ae6d9 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Fri, 4 Oct 2024 16:01:27 +0200 Subject: [PATCH 11/67] Refactor --- testing/e2e/skr/skr-binding-test/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index bfc5859313..36f5ba8b0f 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -64,11 +64,11 @@ describe('SKR Binding test', function() { */ it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 10; - try { - kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); - console.log("The test was expected to fail but it passed"); - expect.fail(); - } catch (err) { } + + expect( function () { + keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); + } ).to.throw( Error ); + }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { From 2f52a5f7dc84599704d3a5deea0865af9e8f0ea0 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 08:46:11 +0200 Subject: [PATCH 12/67] Better expect --- testing/e2e/skr/skr-binding-test/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 36f5ba8b0f..bfeb55a769 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,15 +66,15 @@ describe('SKR Binding test', function() { const expirationSeconds = 10; expect( function () { - keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); - } ).to.throw( Error ); + keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + } ).to.throw(); }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 700; try { - kubeconfigFromBinding = await keb.createBinding("4D0CE8A5-714F-45E1-9B17-FE34FEEFF44B", true, expirationSeconds); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); expect.fail(); } catch (err) { } From d11e18c94ca44549f68cebab4229ee7ce6f224fa Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 08:49:17 +0200 Subject: [PATCH 13/67] Increase timeout --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index bfeb55a769..1132de7b66 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -74,7 +74,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 700; try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(5000); console.log("The test was expected to fail but it passed"); expect.fail(); } catch (err) { } From a720c4c67e37a6c0989481294035b929442baed0 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 08:51:50 +0200 Subject: [PATCH 14/67] Change assertion --- testing/e2e/skr/skr-binding-test/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 1132de7b66..6efa71e164 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,9 +65,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 10; - expect( function () { - keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); - } ).to.throw(); + expect(keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds)).to.throw(); }); From e1c2cbf94b2a88d0db8e599b263a25f4982ed354 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 08:54:53 +0200 Subject: [PATCH 15/67] Tiemout --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 6efa71e164..79f72f17d3 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,7 +65,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 10; - expect(keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds)).to.throw(); + expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(5000); }).to.throw(); }); From b0a4f6e26de5225ecf56cfa695cb27069d20be29 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 08:57:01 +0200 Subject: [PATCH 16/67] Timeout --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 79f72f17d3..5b1c2c1596 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -63,7 +63,7 @@ describe('SKR Binding test', function() { }); */ it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { - const expirationSeconds = 10; + const expirationSeconds = 700; expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(5000); }).to.throw(); From 2af22f11c9cd85af5f54c5c9daa8e4ca69854a5b Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:12:19 +0200 Subject: [PATCH 17/67] Increase timeout --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 5b1c2c1596..24c11cc4e7 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,14 +65,14 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 700; - expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(5000); }).to.throw(); + expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); }).to.throw(); }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 700; try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(5000); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); console.log("The test was expected to fail but it passed"); expect.fail(); } catch (err) { } From 9d41829a389c213af66952f688896ab20789d971 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:19:54 +0200 Subject: [PATCH 18/67] More test --- testing/e2e/skr/skr-binding-test/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 24c11cc4e7..48389eae1f 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -27,10 +27,10 @@ describe('SKR Binding test', function() { this.timeout(provisioningTimeout); await provisionSKRInstance(options, provisioningTimeout); }); - +*/ it('Create SKR binding for service account using Kubernetes TokenRequest', async function() { try { - kubeconfigFromBinding = await keb.createBinding(options.instanceID, true); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true); } catch (err) { console.log(err); } @@ -47,7 +47,7 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; try { - kubeconfigFromBinding = await keb.createBinding(options.instanceID, false, expirationSeconds); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", false, expirationSeconds); expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.credentials.kubeconfig)).to.equal(expirationSeconds); } catch (err) { console.log(err); @@ -61,7 +61,7 @@ describe('SKR Binding test', function() { it('Fetch sap-btp-manager secret using binding from Gardener', async function() { await getSecret(secretName, ns); }); -*/ + it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 700; From 0e34c4aba95ce171f65520c64f22bfdff180cab9 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:27:54 +0200 Subject: [PATCH 19/67] Change expiration --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 48389eae1f..2c6775e9f6 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,12 +65,12 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 700; - expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); }).to.throw(); + await expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); }).to.throw(); }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { - const expirationSeconds = 700; + const expirationSeconds = 1; try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); console.log("The test was expected to fail but it passed"); From f33574aae57bb93fdc0821940cd4e1a6a4132b8f Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:30:51 +0200 Subject: [PATCH 20/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 2c6775e9f6..b4031a11f7 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -70,12 +70,13 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { - const expirationSeconds = 1; + const expirationSeconds = 700; try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); - console.log("The test was expected to fail but it passed"); - expect.fail(); + // console.log("The test was expected to fail but it passed"); + //expect.fail(); } catch (err) { } + console.log(err); }); /* after('Cleanup the resources', async function() { From 4cc9dc79143306ab71d380e5448148612442eaa3 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:31:33 +0200 Subject: [PATCH 21/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index b4031a11f7..5df9bb6843 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -70,7 +70,7 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { - const expirationSeconds = 700; + const expirationSeconds = 1; try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); // console.log("The test was expected to fail but it passed"); From ab4157855a11607722ba5276af51178138f4d2f8 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:35:15 +0200 Subject: [PATCH 22/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 5df9bb6843..dbda3185e3 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -76,7 +76,7 @@ describe('SKR Binding test', function() { // console.log("The test was expected to fail but it passed"); //expect.fail(); } catch (err) { } - console.log(err); + console.log("The test failed as expected"); }); /* after('Cleanup the resources', async function() { From 929b8d499d2d8d699aca765d338fb23c26ecdd16 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:38:39 +0200 Subject: [PATCH 23/67] Tiemouts --- testing/e2e/skr/skr-binding-test/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index dbda3185e3..d876452386 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -64,15 +64,17 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 700; + this.timeout(10000); - await expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); }).to.throw(); + await expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 1; + this.timeout(10000); try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).timeout(10000); + kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); // console.log("The test was expected to fail but it passed"); //expect.fail(); } catch (err) { } From 3a82ee24145b6f49ba27ac10163352b868dfc4b8 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:42:20 +0200 Subject: [PATCH 24/67] Tiemouts --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index d876452386..d8b2f4d771 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -63,7 +63,7 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { - const expirationSeconds = 700; + const expirationSeconds = 1; this.timeout(10000); await expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); From a9f163a6b331ad488c70ca4efa444611e4b1fbe0 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:50:10 +0200 Subject: [PATCH 25/67] Refactor --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index d8b2f4d771..39e3982c3e 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,7 +66,7 @@ describe('SKR Binding test', function() { const expirationSeconds = 1; this.timeout(10000); - await expect(function () { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); + expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).rejects.toThrow(); }); From 43592af47a595440792871e971584d55fe492c05 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:53:10 +0200 Subject: [PATCH 26/67] Refactor --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 39e3982c3e..a1f2234732 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,7 +66,7 @@ describe('SKR Binding test', function() { const expirationSeconds = 1; this.timeout(10000); - expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).rejects.toThrow(); + expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); }); From 93c505d9d709bacf3aeb78e8604bfd190b1892f5 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 09:59:35 +0200 Subject: [PATCH 27/67] Reject --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index a1f2234732..32fc9f8960 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,8 +65,8 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; this.timeout(10000); - - expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); + return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; + // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); }); From ecfb4134fae06e285543df6f5f4f5d201f1cc907 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 10:05:24 +0200 Subject: [PATCH 28/67] Import chai --- testing/e2e/skr/skr-binding-test/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 32fc9f8960..828b5e03ba 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -1,4 +1,4 @@ -const {expect} = require('chai'); +const chai = require('chai'); const {gatherOptions} = require('../skr-test'); const {initializeK8sClient} = require('../utils/index.js'); const {getSecret, getKubeconfigValidityInSeconds} = require('../utils'); @@ -7,12 +7,15 @@ const {deprovisionAndUnregisterSKR} = require('../skr-test/provision/deprovision const {KEBClient, KEBConfig} = require('../kyma-environment-broker'); const keb = new KEBClient(KEBConfig.fromEnv()); + const provisioningTimeout = 1000 * 60 * 30; // 30m const deprovisioningTimeout = 1000 * 60 * 95; // 95m let globalTimeout = 1000 * 60 * 70; // 70m const slowTime = 5000; const secretName = 'sap-btp-manager'; const ns = 'kyma-system'; +const {expect} = chai; +chai.use(require('chai-as-promised')); describe('SKR Binding test', function() { /* globalTimeout += provisioningTimeout + deprovisioningTimeout; From 3c421c7bec8bc34db80af11d625f7b07aabefaca Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 10:17:43 +0200 Subject: [PATCH 29/67] Change test --- testing/e2e/skr/skr-binding-test/index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 828b5e03ba..c5c00797cb 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -1,4 +1,4 @@ -const chai = require('chai'); +const {expect} = require('chai'); const {gatherOptions} = require('../skr-test'); const {initializeK8sClient} = require('../utils/index.js'); const {getSecret, getKubeconfigValidityInSeconds} = require('../utils'); @@ -14,8 +14,6 @@ let globalTimeout = 1000 * 60 * 70; // 70m const slowTime = 5000; const secretName = 'sap-btp-manager'; const ns = 'kyma-system'; -const {expect} = chai; -chai.use(require('chai-as-promised')); describe('SKR Binding test', function() { /* globalTimeout += provisioningTimeout + deprovisioningTimeout; @@ -68,8 +66,18 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; this.timeout(10000); - return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; + // return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); + try { + await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + fail('KEB must return an error'); + } catch (err) { + //expect(err.response.status).equal(400); + // expect(err.response.data.description).to.include('overlap'); + console.log('Got response:'); + console.log(err.response.status); + console.log(err.response.data); + } }); From 6d092c3ffd335c99531e52f808177197a36514c5 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 10:26:37 +0200 Subject: [PATCH 30/67] Change logs --- testing/e2e/skr/skr-binding-test/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index c5c00797cb..0b16349933 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -75,8 +75,7 @@ describe('SKR Binding test', function() { //expect(err.response.status).equal(400); // expect(err.response.data.description).to.include('overlap'); console.log('Got response:'); - console.log(err.response.status); - console.log(err.response.data); + console.log(err); } }); From 7c780a581164656f9a29042245e0baf89ea842f6 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:00:27 +0200 Subject: [PATCH 31/67] Change call --- testing/e2e/skr/skr-binding-test/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 0b16349933..6d23bd9198 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,16 +66,25 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; this.timeout(10000); + const bindingID = Math.random().toString(36).substring(2, 18); + + + const customParams = {'service_account': true, 'expiration_seconds': expirationSeconds}; + const payload = keb.buildPayload('binding', "0EFB3BD5-EDA1-4659-AA18-597236230931", null, null, customParams); + const endpoint = `service_instances/0EFB3BD5-EDA1-4659-AA18-597236230931/service_bindings/${bindingID}?accepts_incomplete=true`; + + const config = await keb.buildRequest(payload, endpoint, 'put'); + // return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { - await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + await axios.request(config); fail('KEB must return an error'); } catch (err) { - //expect(err.response.status).equal(400); - // expect(err.response.data.description).to.include('overlap'); console.log('Got response:'); - console.log(err); + // console.log(err.response.data); + //console.log(err.response.status); + console.log(err.response); } }); From 8d6796669b2fc0aff0348912c7ef0d6639cba6cd Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:04:05 +0200 Subject: [PATCH 32/67] Change call --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 6d23bd9198..91a2b40e0d 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -82,9 +82,9 @@ describe('SKR Binding test', function() { fail('KEB must return an error'); } catch (err) { console.log('Got response:'); - // console.log(err.response.data); + console.log(err.response.data); //console.log(err.response.status); - console.log(err.response); + console.log(err); } }); From 57d04b31e12d967dfc15b59b0402fc580695cc41 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:12:02 +0200 Subject: [PATCH 33/67] Test alternative --- .../e2e/skr/kyma-environment-broker/client.js | 23 ++++++++++++++++++- testing/e2e/skr/skr-binding-test/index.js | 14 +++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index c1e042073b..d2f2513a99 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -273,7 +273,28 @@ class KEBClient { }); } - async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { + async createBinding2(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // + const payload = { + service_id: KYMA_SERVICE_ID, + plan_id: this.planID, + parameters: { + service_account: serviceAccount, + expiration_seconds: expirationSeconds, + }, + }; + const bindingID = Math.random().toString(36).substring(2, 18); + const endpoint = `service_instances/${instanceID}/service_bindings/${bindingID}?accepts_incomplete=true`; + const config = await keb.buildRequest(payload, endpoint, 'put'); + + try { + await axios.request(config); + fail('KEB must return an error'); + } catch (err) { + throw err; + } + } + + async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // const payload = { service_id: KYMA_SERVICE_ID, plan_id: this.planID, diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 91a2b40e0d..876230b5ac 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,19 +66,19 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; this.timeout(10000); - const bindingID = Math.random().toString(36).substring(2, 18); + // const bindingID = Math.random().toString(36).substring(2, 18); - const customParams = {'service_account': true, 'expiration_seconds': expirationSeconds}; - const payload = keb.buildPayload('binding', "0EFB3BD5-EDA1-4659-AA18-597236230931", null, null, customParams); - const endpoint = `service_instances/0EFB3BD5-EDA1-4659-AA18-597236230931/service_bindings/${bindingID}?accepts_incomplete=true`; + // const customParams = {'service_account': true, 'expiration_seconds': expirationSeconds}; + // const payload = keb.buildPayload('binding', "0EFB3BD5-EDA1-4659-AA18-597236230931", null, null, customParams); + //const endpoint = `service_instances/0EFB3BD5-EDA1-4659-AA18-597236230931/service_bindings/${bindingID}?accepts_incomplete=true`; - const config = await keb.buildRequest(payload, endpoint, 'put'); + //const config = await keb.buildRequest(payload, endpoint, 'put'); - // return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; + //return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { - await axios.request(config); + await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); fail('KEB must return an error'); } catch (err) { console.log('Got response:'); From 1aff0806e7c64a06f3b4938a6a339f6d77cf8f82 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:12:22 +0200 Subject: [PATCH 34/67] Test alternative --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 876230b5ac..b20b456347 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -78,7 +78,7 @@ describe('SKR Binding test', function() { //return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { - await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); fail('KEB must return an error'); } catch (err) { console.log('Got response:'); From 647adade0cced235a10354feec6679aa18ecc274 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:15:17 +0200 Subject: [PATCH 35/67] Test alternative --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index b20b456347..fe63fc1ed1 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -82,7 +82,7 @@ describe('SKR Binding test', function() { fail('KEB must return an error'); } catch (err) { console.log('Got response:'); - console.log(err.response.data); + // console.log(err.response.data); //console.log(err.response.status); console.log(err); } From fdbd86bd44d39346457517383bd7378eb7fee210 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:16:13 +0200 Subject: [PATCH 36/67] Test alternative --- testing/e2e/skr/kyma-environment-broker/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index d2f2513a99..7b6abaae23 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -284,7 +284,7 @@ class KEBClient { }; const bindingID = Math.random().toString(36).substring(2, 18); const endpoint = `service_instances/${instanceID}/service_bindings/${bindingID}?accepts_incomplete=true`; - const config = await keb.buildRequest(payload, endpoint, 'put'); + const config = await this.buildRequest(payload, endpoint, 'put'); try { await axios.request(config); From 11cdac68e874cc9ce6b5d9ee2c2f62d7f6137b82 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:19:08 +0200 Subject: [PATCH 37/67] Test alternative --- testing/e2e/skr/skr-binding-test/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index fe63fc1ed1..acd106e989 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -82,9 +82,9 @@ describe('SKR Binding test', function() { fail('KEB must return an error'); } catch (err) { console.log('Got response:'); - // console.log(err.response.data); - //console.log(err.response.status); - console.log(err); + console.log(err.response.data); + console.log(err.response.status); + // console.log(err); } }); From 261b8727081b0d005f57151b0e3756e8fd95ff10 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:24:34 +0200 Subject: [PATCH 38/67] Test alternative --- testing/e2e/skr/skr-binding-test/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index acd106e989..29f00139e5 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -47,6 +47,7 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; + this.timeout(10000); try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", false, expirationSeconds); expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.credentials.kubeconfig)).to.equal(expirationSeconds); @@ -81,10 +82,10 @@ describe('SKR Binding test', function() { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); fail('KEB must return an error'); } catch (err) { + expect(err.response.status).equal(400); + expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); console.log('Got response:'); console.log(err.response.data); - console.log(err.response.status); - // console.log(err); } }); From d54a3289e9d2bde5aaa338aebfa4b4bd8291f8d7 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:27:59 +0200 Subject: [PATCH 39/67] Fail test --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 29f00139e5..84f0f9f7a1 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,7 +65,7 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { - const expirationSeconds = 1; + const expirationSeconds = 700; this.timeout(10000); // const bindingID = Math.random().toString(36).substring(2, 18); From 7dba80ab9ae3184f1d34d07123eee5f84d7eb75e Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:32:04 +0200 Subject: [PATCH 40/67] Expect fail --- testing/e2e/skr/skr-binding-test/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 84f0f9f7a1..d99be50b3a 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -80,7 +80,8 @@ describe('SKR Binding test', function() { // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); - fail('KEB must return an error'); + console.log("The test was expected to fail but it passed"); + expect.fail(); } catch (err) { expect(err.response.status).equal(400); expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); From 61e9cff7bd6b0887139ebf61d499f24d3953ad15 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:35:57 +0200 Subject: [PATCH 41/67] Expect fail --- testing/e2e/skr/skr-binding-test/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index d99be50b3a..9c2106a6ea 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -81,7 +81,6 @@ describe('SKR Binding test', function() { try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); - expect.fail(); } catch (err) { expect(err.response.status).equal(400); expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); From b095823815700a9066617143bcafec85b0d7776b Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:39:28 +0200 Subject: [PATCH 42/67] Error repsonse --- testing/e2e/skr/skr-binding-test/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 9c2106a6ea..daa7a853e3 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -82,10 +82,15 @@ describe('SKR Binding test', function() { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); } catch (err) { - expect(err.response.status).equal(400); - expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); - console.log('Got response:'); + if (err.response) { + expect(err.response.status).equal(400); + expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); + console.log('Got response:'); console.log(err.response.data); + } else { + console.log('Error response not available'); + } + } }); From 0c0e9c718341200e549872beb31ffab41af8641f Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:42:21 +0200 Subject: [PATCH 43/67] Logs --- testing/e2e/skr/skr-binding-test/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index daa7a853e3..63b059caee 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -81,14 +81,15 @@ describe('SKR Binding test', function() { try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); + expect.fail("The test was expected to fail but it passed"); } catch (err) { if (err.response) { expect(err.response.status).equal(400); expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); console.log('Got response:'); - console.log(err.response.data); + console.log(err.response.data); } else { - console.log('Error response not available'); + console.log(err); } } From dcfdf1a6b7224435b909e9c60ac4495a8f747d5b Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:48:49 +0200 Subject: [PATCH 44/67] Logs --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 63b059caee..f3581c855a 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -81,7 +81,7 @@ describe('SKR Binding test', function() { try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); - expect.fail("The test was expected to fail but it passed"); + assert.fail("The test was expected to fail but it passed") } catch (err) { if (err.response) { expect(err.response.status).equal(400); @@ -89,7 +89,7 @@ describe('SKR Binding test', function() { console.log('Got response:'); console.log(err.response.data); } else { - console.log(err); + console.log('Error response not available'); } } From 882020c1631cfcc92e57b89eefb15565a07ccf30 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 11:52:47 +0200 Subject: [PATCH 45/67] Change fail --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index f3581c855a..d86aa1912f 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -81,7 +81,7 @@ describe('SKR Binding test', function() { try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); - assert.fail("The test was expected to fail but it passed") + done(new Error("The test was expected to fail but it passed")); } catch (err) { if (err.response) { expect(err.response.status).equal(400); From 45a8a73d8b4e4b97e6f356cbf544b47415e5e6bf Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 12:05:03 +0200 Subject: [PATCH 46/67] Change fail --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index d86aa1912f..880d581704 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -81,7 +81,7 @@ describe('SKR Binding test', function() { try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); console.log("The test was expected to fail but it passed"); - done(new Error("The test was expected to fail but it passed")); + assert.fail("The test was expected to fail but it passed") } catch (err) { if (err.response) { expect(err.response.status).equal(400); @@ -89,7 +89,7 @@ describe('SKR Binding test', function() { console.log('Got response:'); console.log(err.response.data); } else { - console.log('Error response not available'); + throw err; } } From 4326eebc8f754e0203416b955436026d48516445 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 12:55:34 +0200 Subject: [PATCH 47/67] Add asert --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 880d581704..8c92933b74 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -1,4 +1,4 @@ -const {expect} = require('chai'); +const {expect, assert} = require('chai'); const {gatherOptions} = require('../skr-test'); const {initializeK8sClient} = require('../utils/index.js'); const {getSecret, getKubeconfigValidityInSeconds} = require('../utils'); From 7da749f742eeada4b30b7a34da48a3d213a75bbc Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:00:43 +0200 Subject: [PATCH 48/67] Change to done --- testing/e2e/skr/skr-binding-test/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 8c92933b74..3a1bb8b6a5 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -1,4 +1,4 @@ -const {expect, assert} = require('chai'); +const {expect} = require('chai'); const {gatherOptions} = require('../skr-test'); const {initializeK8sClient} = require('../utils/index.js'); const {getSecret, getKubeconfigValidityInSeconds} = require('../utils'); @@ -80,8 +80,7 @@ describe('SKR Binding test', function() { // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); - console.log("The test was expected to fail but it passed"); - assert.fail("The test was expected to fail but it passed") + done(new Error("The call was expected to fail but it passed")); } catch (err) { if (err.response) { expect(err.response.status).equal(400); @@ -89,6 +88,7 @@ describe('SKR Binding test', function() { console.log('Got response:'); console.log(err.response.data); } else { + console.log(err); throw err; } From 73798cc43fe5c4d6eb75ff89b927500aaa6a8109 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:03:47 +0200 Subject: [PATCH 49/67] Fix client --- testing/e2e/skr/kyma-environment-broker/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index 7b6abaae23..31251bfa88 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -288,7 +288,7 @@ class KEBClient { try { await axios.request(config); - fail('KEB must return an error'); + throw new Error('KEB must return an error'); } catch (err) { throw err; } From 9434f977b2157c34823602e9304cc42bc3c9b56b Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:09:57 +0200 Subject: [PATCH 50/67] Fix bug --- testing/e2e/skr/kyma-environment-broker/client.js | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index 31251bfa88..759c3efe59 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -288,7 +288,6 @@ class KEBClient { try { await axios.request(config); - throw new Error('KEB must return an error'); } catch (err) { throw err; } From 57b13ea80cc9d9d8ff53dfdc312b17da3d27bd32 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:13:32 +0200 Subject: [PATCH 51/67] Expect --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 3a1bb8b6a5..e6f90a6032 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -80,7 +80,7 @@ describe('SKR Binding test', function() { // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); - done(new Error("The call was expected to fail but it passed")); + expect.fail("The call was expected to fail but it passed"); } catch (err) { if (err.response) { expect(err.response.status).equal(400); From 7f1d906c8df1571176f945575917fd02dc124cc1 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:20:15 +0200 Subject: [PATCH 52/67] Dont log --- testing/e2e/skr/skr-binding-test/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index e6f90a6032..f6b676098f 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -87,10 +87,10 @@ describe('SKR Binding test', function() { expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); console.log('Got response:'); console.log(err.response.data); - } else { - console.log(err); - throw err; - } + } //else { + // console.log(err); + // throw err; + // } } From 1d87ec1191839a1954cf52022d1c3d42c3031d2f Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:22:55 +0200 Subject: [PATCH 53/67] Dont log --- testing/e2e/skr/skr-binding-test/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index f6b676098f..1d7a5cd709 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -87,10 +87,9 @@ describe('SKR Binding test', function() { expect(err.response.data.description).to.include('expiration_seconds cannot be less than'); console.log('Got response:'); console.log(err.response.data); - } //else { - // console.log(err); - // throw err; - // } + } else { + throw err; + } } From f57543e947929638cce2ab69ce3e31ede6ccefe4 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:27:02 +0200 Subject: [PATCH 54/67] Test --- testing/e2e/skr/skr-binding-test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 1d7a5cd709..c484158adc 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,7 +65,7 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { - const expirationSeconds = 700; + const expirationSeconds = 999999999; this.timeout(10000); // const bindingID = Math.random().toString(36).substring(2, 18); From de26ec83adadea0790da7b8cc821b6e3376ca514 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:29:57 +0200 Subject: [PATCH 55/67] Fix test --- testing/e2e/skr/skr-binding-test/index.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index c484158adc..178a616fe6 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,19 +65,8 @@ describe('SKR Binding test', function() { }); it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { - const expirationSeconds = 999999999; + const expirationSeconds = 1; this.timeout(10000); - // const bindingID = Math.random().toString(36).substring(2, 18); - - - // const customParams = {'service_account': true, 'expiration_seconds': expirationSeconds}; - // const payload = keb.buildPayload('binding', "0EFB3BD5-EDA1-4659-AA18-597236230931", null, null, customParams); - //const endpoint = `service_instances/0EFB3BD5-EDA1-4659-AA18-597236230931/service_bindings/${bindingID}?accepts_incomplete=true`; - - //const config = await keb.buildRequest(payload, endpoint, 'put'); - - //return keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds).should.be.rejected; - // expect(async () => { keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); }).to.throw(); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); From e7d5618c4293962eaff2c4fa9b41c9b8f98879f4 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:32:54 +0200 Subject: [PATCH 56/67] Prepare second test --- testing/e2e/skr/skr-binding-test/index.js | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 178a616fe6..97f7a547c1 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -78,21 +78,26 @@ describe('SKR Binding test', function() { console.log(err.response.data); } else { throw err; - } - - } - + } + } }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { - const expirationSeconds = 1; + const expirationSeconds = 999999999; this.timeout(10000); try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); - // console.log("The test was expected to fail but it passed"); - //expect.fail(); - } catch (err) { } - console.log("The test failed as expected"); + await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + expect.fail("The call was expected to fail but it passed"); + } catch (err) { + if (err.response) { + expect(err.response.status).equal(400); + expect(err.response.data.description).to.include('expiration_seconds cannot be greater than'); + console.log('Got response:'); + console.log(err.response.data); + } else { + throw err; + } + } }); /* after('Cleanup the resources', async function() { From aca6e833685ee8dfb7de52aa2a549b79ddcc004d Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:39:12 +0200 Subject: [PATCH 57/67] Better timeouts --- testing/e2e/skr/skr-binding-test/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 97f7a547c1..7f0f6732d4 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -16,6 +16,7 @@ const secretName = 'sap-btp-manager'; const ns = 'kyma-system'; describe('SKR Binding test', function() { + this.timeout(10000); /* globalTimeout += provisioningTimeout + deprovisioningTimeout; this.timeout(globalTimeout); @@ -47,7 +48,7 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; - this.timeout(10000); + // this.timeout(10000); try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", false, expirationSeconds); expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.credentials.kubeconfig)).to.equal(expirationSeconds); @@ -66,7 +67,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; - this.timeout(10000); + // this.timeout(10000); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); @@ -84,7 +85,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 999999999; - this.timeout(10000); + // this.timeout(10000); try { await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); From ab407d089b7920b4d4168d3f49e95e74b5c6d692 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:41:32 +0200 Subject: [PATCH 58/67] Better timeouts --- testing/e2e/skr/skr-binding-test/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 7f0f6732d4..aa47a440a0 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -30,6 +30,10 @@ describe('SKR Binding test', function() { await provisionSKRInstance(options, provisioningTimeout); }); */ + + before('Ensure SKR is provisioned', async function() { + await new Promise(r => setTimeout(r, 20000)); + }); it('Create SKR binding for service account using Kubernetes TokenRequest', async function() { try { kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true); From a6b07e405fc52340d67f438929f1e3bdd47c41dd Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:47:28 +0200 Subject: [PATCH 59/67] Full test --- .../e2e/skr/kyma-environment-broker/client.js | 20 +--------------- testing/e2e/skr/skr-binding-test/index.js | 24 +++++++------------ 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index 759c3efe59..26a83a3e7a 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -273,7 +273,7 @@ class KEBClient { }); } - async createBinding2(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // + async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // const payload = { service_id: KYMA_SERVICE_ID, plan_id: this.planID, @@ -293,24 +293,6 @@ class KEBClient { } } - async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // - const payload = { - service_id: KYMA_SERVICE_ID, - plan_id: this.planID, - parameters: { - service_account: serviceAccount, - expiration_seconds: expirationSeconds, - }, - }; - const bindingID = Math.random().toString(36).substring(2, 18); - const endpoint = `service_instances/${instanceID}/service_bindings/${bindingID}?accepts_incomplete=true`; - try { - return await this.callKEB(payload, endpoint, 'put'); - } catch (err) { - throw new Error(`error while creating binding: ${err.toString()}`); - } - } - getPlatformRegion() { if (this.platformRegion && this.platformRegion != '') { return `${this.platformRegion}/`; diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index aa47a440a0..4b6276844b 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -16,8 +16,7 @@ const secretName = 'sap-btp-manager'; const ns = 'kyma-system'; describe('SKR Binding test', function() { - this.timeout(10000); -/* globalTimeout += provisioningTimeout + deprovisioningTimeout; + globalTimeout += provisioningTimeout + deprovisioningTimeout; this.timeout(globalTimeout); this.slow(slowTime); @@ -25,18 +24,14 @@ describe('SKR Binding test', function() { const options = gatherOptions(); // with default values let kubeconfigFromBinding; - before('Ensure SKR is provisioned', async function() { + before('Ensure SKR is provisioned', async function() { this.timeout(provisioningTimeout); await provisionSKRInstance(options, provisioningTimeout); }); -*/ - before('Ensure SKR is provisioned', async function() { - await new Promise(r => setTimeout(r, 20000)); - }); it('Create SKR binding for service account using Kubernetes TokenRequest', async function() { try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", true); + kubeconfigFromBinding = await keb.createBinding(options.instanceID, true); } catch (err) { console.log(err); } @@ -52,9 +47,8 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; - // this.timeout(10000); try { - kubeconfigFromBinding = await keb.createBinding("0EFB3BD5-EDA1-4659-AA18-597236230931", false, expirationSeconds); + kubeconfigFromBinding = await keb.createBinding(options.instanceID, false, expirationSeconds); expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.credentials.kubeconfig)).to.equal(expirationSeconds); } catch (err) { console.log(err); @@ -71,9 +65,8 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; - // this.timeout(10000); try { - await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + await keb.createBinding2(options.instanceID, true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); } catch (err) { if (err.response) { @@ -89,9 +82,8 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 999999999; - // this.timeout(10000); try { - await keb.createBinding2("0EFB3BD5-EDA1-4659-AA18-597236230931", true, expirationSeconds); + await keb.createBinding2(options.instanceID, true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); } catch (err) { if (err.response) { @@ -105,10 +97,10 @@ describe('SKR Binding test', function() { } }); - /* after('Cleanup the resources', async function() { + after('Cleanup the resources', async function() { this.timeout(deprovisioningTimeout); if (process.env['SKIP_DEPROVISIONING'] != 'true') { await deprovisionAndUnregisterSKR(options, deprovisioningTimeout, true); } - });*/ + }); }); From a2c621d76e3668aa48588513a302851d0d2e5788 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 13:48:15 +0200 Subject: [PATCH 60/67] Full test --- testing/e2e/skr/kyma-environment-broker/client.js | 2 +- testing/e2e/skr/skr-binding-test/index.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index 26a83a3e7a..4f778f8834 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -273,7 +273,7 @@ class KEBClient { }); } - async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { // + async createBinding(instanceID, serviceAccount, expirationSeconds = DEFAULT_EXPIRATION_SECONDS) { const payload = { service_id: KYMA_SERVICE_ID, plan_id: this.planID, diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 4b6276844b..738f7a84f9 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -7,7 +7,6 @@ const {deprovisionAndUnregisterSKR} = require('../skr-test/provision/deprovision const {KEBClient, KEBConfig} = require('../kyma-environment-broker'); const keb = new KEBClient(KEBConfig.fromEnv()); - const provisioningTimeout = 1000 * 60 * 30; // 30m const deprovisioningTimeout = 1000 * 60 * 95; // 95m let globalTimeout = 1000 * 60 * 70; // 70m From 99afb32c8c0f89c5c676c59089abb31bd2bf0a55 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 14:44:40 +0200 Subject: [PATCH 61/67] Fix function --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 738f7a84f9..fb5b8b00f3 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -65,7 +65,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { const expirationSeconds = 1; try { - await keb.createBinding2(options.instanceID, true, expirationSeconds); + await keb.createBinding(options.instanceID, true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); } catch (err) { if (err.response) { @@ -82,7 +82,7 @@ describe('SKR Binding test', function() { it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 999999999; try { - await keb.createBinding2(options.instanceID, true, expirationSeconds); + await keb.createBinding(options.instanceID, true, expirationSeconds); expect.fail("The call was expected to fail but it passed"); } catch (err) { if (err.response) { From 3883ac8241017071e039cf2e7a763edf6cc2294b Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 15:06:20 +0200 Subject: [PATCH 62/67] Add missing return --- testing/e2e/skr/kyma-environment-broker/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/kyma-environment-broker/client.js b/testing/e2e/skr/kyma-environment-broker/client.js index 4f778f8834..368bee0b2b 100644 --- a/testing/e2e/skr/kyma-environment-broker/client.js +++ b/testing/e2e/skr/kyma-environment-broker/client.js @@ -287,7 +287,7 @@ class KEBClient { const config = await this.buildRequest(payload, endpoint, 'put'); try { - await axios.request(config); + return await axios.request(config); } catch (err) { throw err; } From c988cf7f5ae4f64aa1be39b964c1d03d919f08e8 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 15:35:46 +0200 Subject: [PATCH 63/67] Fix access --- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index fb5b8b00f3..5f4b671564 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -37,7 +37,7 @@ describe('SKR Binding test', function() { }); it('Initiate K8s client with kubeconfig from binding', async function() { - await initializeK8sClient({kubeconfig: kubeconfigFromBinding.credentials.kubeconfig}); + await initializeK8sClient({kubeconfig: kubeconfigFromBinding.data.credentials.kubeconfig}); }); it('Fetch sap-btp-manager secret using binding for service account from Kubernetes TokenRequest', async function() { @@ -48,7 +48,7 @@ describe('SKR Binding test', function() { const expirationSeconds = 900; try { kubeconfigFromBinding = await keb.createBinding(options.instanceID, false, expirationSeconds); - expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.credentials.kubeconfig)).to.equal(expirationSeconds); + expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.data.credentials.kubeconfig)).to.equal(expirationSeconds); } catch (err) { console.log(err); } From c19a71b51c3f63762b710c01e656d95ae76d9dae Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 15:55:16 +0200 Subject: [PATCH 64/67] Lint fix --- testing/e2e/skr/skr-binding-test/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index 5f4b671564..d257a1005c 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -66,7 +66,7 @@ describe('SKR Binding test', function() { const expirationSeconds = 1; try { await keb.createBinding(options.instanceID, true, expirationSeconds); - expect.fail("The call was expected to fail but it passed"); + expect.fail('The call was expected to fail but it passed'); } catch (err) { if (err.response) { expect(err.response.status).equal(400); @@ -75,15 +75,15 @@ describe('SKR Binding test', function() { console.log(err.response.data); } else { throw err; - } - } + } + } }); it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { const expirationSeconds = 999999999; try { await keb.createBinding(options.instanceID, true, expirationSeconds); - expect.fail("The call was expected to fail but it passed"); + expect.fail('The call was expected to fail but it passed'); } catch (err) { if (err.response) { expect(err.response.status).equal(400); @@ -92,7 +92,7 @@ describe('SKR Binding test', function() { console.log(err.response.data); } else { throw err; - } + } } }); From 540b4e2430dd94af8888e82c09e68bea7b2d1297 Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 16:01:44 +0200 Subject: [PATCH 65/67] Fix --- testing/e2e/skr/skr-binding-test/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index d257a1005c..a52274ec55 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -30,14 +30,15 @@ describe('SKR Binding test', function() { it('Create SKR binding for service account using Kubernetes TokenRequest', async function() { try { - kubeconfigFromBinding = await keb.createBinding(options.instanceID, true); + resp = await keb.createBinding(options.instanceID, true); + kubeconfigFromBinding = resp.data.credentials.kubeconfig; } catch (err) { console.log(err); } }); it('Initiate K8s client with kubeconfig from binding', async function() { - await initializeK8sClient({kubeconfig: kubeconfigFromBinding.data.credentials.kubeconfig}); + await initializeK8sClient({kubeconfig: kubeconfigFromBinding}); }); it('Fetch sap-btp-manager secret using binding for service account from Kubernetes TokenRequest', async function() { @@ -47,22 +48,23 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; try { - kubeconfigFromBinding = await keb.createBinding(options.instanceID, false, expirationSeconds); - expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding.data.credentials.kubeconfig)).to.equal(expirationSeconds); + resp = await keb.createBinding(options.instanceID, false, expirationSeconds); + kubeconfigFromBinding = resp.data.credentials.kubeconfig; + expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding)).to.equal(expirationSeconds); } catch (err) { console.log(err); } }); it('Initiate K8s client with kubeconfig from binding', async function() { - await initializeK8sClient({kubeconfig: kubeconfigFromBinding.credentials.kubeconfig}); + await initializeK8sClient({kubeconfig: kubeconfigFromBinding}); }); it('Fetch sap-btp-manager secret using binding from Gardener', async function() { await getSecret(secretName, ns); }); - it('Should not allow creation of SKR binding when expiration seconds value is below the minimum value', async function() { + it('Should not allow creation of SKR binding when expiration seconds value is below the min value', async function() { const expirationSeconds = 1; try { await keb.createBinding(options.instanceID, true, expirationSeconds); @@ -79,7 +81,7 @@ describe('SKR Binding test', function() { } }); - it('Should not allow creation of SKR binding when expiration seconds value is over the maximum value', async function() { + it('Should not allow creation of SKR binding when expiration seconds value is over the max value', async function() { const expirationSeconds = 999999999; try { await keb.createBinding(options.instanceID, true, expirationSeconds); From 020beebef7f3448c2c96e712d5f4dee51ad5bb4f Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 16:24:30 +0200 Subject: [PATCH 66/67] Disable leaks check --- testing/e2e/skr/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/e2e/skr/package.json b/testing/e2e/skr/package.json index 38fae43ddf..bf328e9cec 100644 --- a/testing/e2e/skr/package.json +++ b/testing/e2e/skr/package.json @@ -15,7 +15,7 @@ "skr-aws-upgrade-integration-test": "mocha --inline-diffs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-aws-upgrade-integration/index.js", "skr-networking-test": "mocha --inline-difs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-networking-test/index.js", "skr-trial-suspension-test": "DEBUG=true mocha --inline-diffs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json --bail ./trial-suspension-test/test.js", - "skr-binding-test": "mocha --inline-difs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-binding-test/index.js" + "skr-binding-test": "mocha --inline-difs --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-binding-test/index.js" }, "license": "Apache-2.0", "devDependencies": { From fc450e24bdfd4d2630b87a6852fcdb5b9535ec4f Mon Sep 17 00:00:00 2001 From: Marek Michali Date: Mon, 7 Oct 2024 16:26:57 +0200 Subject: [PATCH 67/67] To const --- testing/e2e/skr/package.json | 2 +- testing/e2e/skr/skr-binding-test/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/e2e/skr/package.json b/testing/e2e/skr/package.json index bf328e9cec..38fae43ddf 100644 --- a/testing/e2e/skr/package.json +++ b/testing/e2e/skr/package.json @@ -15,7 +15,7 @@ "skr-aws-upgrade-integration-test": "mocha --inline-diffs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-aws-upgrade-integration/index.js", "skr-networking-test": "mocha --inline-difs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-networking-test/index.js", "skr-trial-suspension-test": "DEBUG=true mocha --inline-diffs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json --bail ./trial-suspension-test/test.js", - "skr-binding-test": "mocha --inline-difs --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-binding-test/index.js" + "skr-binding-test": "mocha --inline-difs --check-leaks --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json ./skr-binding-test/index.js" }, "license": "Apache-2.0", "devDependencies": { diff --git a/testing/e2e/skr/skr-binding-test/index.js b/testing/e2e/skr/skr-binding-test/index.js index a52274ec55..27c9dbdd13 100644 --- a/testing/e2e/skr/skr-binding-test/index.js +++ b/testing/e2e/skr/skr-binding-test/index.js @@ -30,7 +30,7 @@ describe('SKR Binding test', function() { it('Create SKR binding for service account using Kubernetes TokenRequest', async function() { try { - resp = await keb.createBinding(options.instanceID, true); + const resp = await keb.createBinding(options.instanceID, true); kubeconfigFromBinding = resp.data.credentials.kubeconfig; } catch (err) { console.log(err); @@ -48,7 +48,7 @@ describe('SKR Binding test', function() { it('Create SKR binding using Gardener', async function() { const expirationSeconds = 900; try { - resp = await keb.createBinding(options.instanceID, false, expirationSeconds); + const resp = await keb.createBinding(options.instanceID, false, expirationSeconds); kubeconfigFromBinding = resp.data.credentials.kubeconfig; expect(getKubeconfigValidityInSeconds(kubeconfigFromBinding)).to.equal(expirationSeconds); } catch (err) {