trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mitchell...@apache.org
Subject [trafficcontrol] branch master updated: Add TP test for DNSSEC keys (#3735)
Date Tue, 23 Jul 2019 21:01:55 GMT
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 0bfc7b7  Add TP test for DNSSEC keys (#3735)
0bfc7b7 is described below

commit 0bfc7b709595edb2ff34c0ef36bd1d11a9a0ef48
Author: Alex Luckerman <35511862+alexluckerman@users.noreply.github.com>
AuthorDate: Tue Jul 23 15:01:50 2019 -0600

    Add TP test for DNSSEC keys (#3735)
    
    * Add WIP DNSSEC/KSK TP test
    
    * Expand TP test for DNSSEC and KSK keys
    
    * Add async/await
---
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js   | 55 ++++++++++++++++++++--
 traffic_portal/test/end_to_end/CDNs/pageData.js    | 12 ++++-
 .../test/end_to_end/common/commonFunctions.js      |  5 ++
 3 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
index 3fceb5f..d429f8c 100644
--- a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
+++ b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
@@ -25,7 +25,8 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	const commonFunctions = new cfunc();
 	const myNewCDN = 'cdn-' + commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789');
 	const myDomainName = myNewCDN + '.com';
-	const mydnssec = 'true';
+	const mydnssec = false;
+	const myKskDays = commonFunctions.random(365);
 
 	it('should go to the CDNs page', function() {
 		console.log("Go to the CDNs page");
@@ -44,7 +45,7 @@ describe('Traffic Portal CDNs Test Suite', function() {
 		console.log("Filling out form, check create button is enabled and submit");
 		expect(pageData.createButton.isEnabled()).toBe(false);
 		pageData.dnssecEnabled.click();
-		pageData.dnssecEnabled.sendKeys(mydnssec);
+		pageData.dnssecEnabled.sendKeys(mydnssec.toString());
 		pageData.name.sendKeys(myNewCDN);
 		pageData.domainName.sendKeys(myDomainName);
 		expect(pageData.createButton.isEnabled()).toBe(true);
@@ -53,7 +54,7 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	});
 
 	it('should verify the new CDN and then update CDN', function() {
-		console.log("verifying the new CDN and then updating CDN");
+		console.log("Verifying the new CDN and then updating CDN");
 		browser.sleep(250);
 		pageData.searchFilter.sendKeys(myNewCDN);
 		browser.sleep(250);
@@ -66,9 +67,53 @@ describe('Traffic Portal CDNs Test Suite', function() {
 		pageData.domainName.clear();
 		pageData.domainName.sendKeys(myDomainName + 'updated.com');
 		pageData.dnssecEnabled.click();
-		pageData.dnssecEnabled.sendKeys('false');
+		pageData.dnssecEnabled.sendKeys((!mydnssec).toString());
 		pageData.updateButton.click();
-		expect(pageData.domainName.getText() === myDomainName + 'updated.com');
+		expect(pageData.domainName.getAttribute('value')).toEqual(myDomainName + 'updated.com');
+	});
+
+	it('should generate DNSSEC keys', async function() {
+		console.log("Generating DNSSEC keys for the new CDN and and verifying their expiration
date");
+		await pageData.moreButton.click();
+		await pageData.manageDnssecKeysButton.click();
+		expect(pageData.expirationDate.getAttribute('value')).toEqual('');
+		await pageData.generateDnssecKeysButton.click();
+		await pageData.regenerateButton.click();
+		expect(pageData.confirmButton.isEnabled()).toBe(false);
+		await pageData.confirmInput.sendKeys(myNewCDN);
+		expect(pageData.confirmButton.isEnabled()).toBe(true);
+		await pageData.confirmButton.click();
+		const expirationDate = pageData.expirationDate.getAttribute('value').then((expir) =>
{return Date.parse(expir + ' UTC');});
+		const calculatedExpirationDate = Date.now() + 365*24*60*60*1000;
+		expect(expirationDate).toBeCloseTo(calculatedExpirationDate, -4);
+	});
+
+	it('should regenerate DNSSEC keys', async function() {
+		console.log("Renerating DNSSEC keys and verifying their expiration date");
+		await pageData.regenerateDnssecKeysButton.click();
+		await pageData.kskExpirationDays.clear().sendKeys(myKskDays.toString());
+		await pageData.regenerateButton.click();
+		expect(pageData.confirmButton.isEnabled()).toBe(false);
+		await pageData.confirmInput.sendKeys(myNewCDN);
+		expect(pageData.confirmButton.isEnabled()).toBe(true);
+		await pageData.confirmButton.click();
+		const expirationDate = pageData.expirationDate.getAttribute('value').then((expir) =>
{return Date.parse(expir + ' UTC');});
+		const calculatedExpirationDate = Date.now() + myKskDays*24*60*60*1000;
+		expect(expirationDate).toBeCloseTo(calculatedExpirationDate, -4);
+	});
+
+	it('should regenerate KSK keys', async function() {
+		console.log("Regenerating KSK keys and verifying their expiration");
+		await pageData.regenerateKskButton.click();
+		await pageData.kskExpirationDays.clear().sendKeys(myKskDays.toString());
+		await pageData.generateButton.click();
+		expect(pageData.confirmButton.isEnabled()).toBe(false);
+		await pageData.confirmInput.sendKeys(myNewCDN);
+		expect(pageData.confirmButton.isEnabled()).toBe(true);
+		await pageData.confirmButton.click();
+		const expirationDate = pageData.expirationDate.getAttribute('value').then((expir) =>
{return Date.parse(expir + ' UTC');});
+		const calculatedExpirationDate = Date.now() + myKskDays*24*60*60*1000;
+		expect(expirationDate).toBeCloseTo(calculatedExpirationDate, -4);
 	});
 
 });
diff --git a/traffic_portal/test/end_to_end/CDNs/pageData.js b/traffic_portal/test/end_to_end/CDNs/pageData.js
index 687cbd8..5d97b64 100644
--- a/traffic_portal/test/end_to_end/CDNs/pageData.js
+++ b/traffic_portal/test/end_to_end/CDNs/pageData.js
@@ -25,6 +25,16 @@ module.exports = function(){
 	this.deleteButton=element(by.buttonText('Delete'));
 	this.updateButton=element(by.buttonText('Update'));
 	this.searchFilter=element(by.id('cdnsTable_filter')).element(by.css('label')).element(by.css('input'));
-	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
 	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
+	this.moreButton=element(by.buttonText('More'));
+	this.manageDnssecKeysButton=element(by.linkText('Manage DNSSEC Keys'));
+	this.generateDnssecKeysButton=element(by.buttonText('Generate DNSSEC Keys'));
+	this.kskExpirationDays=element(by.name('kskExpirationDays'));
+	this.regenerateButton=element(by.buttonText('Regenerate'));
+	this.confirmInput=element(by.name('confirmEnterForm')).element(by.tagName('input'));
+	this.confirmButton=element(by.buttonText('Confirm'));
+	this.expirationDate=element(by.name('expirationDate'));
+	this.regenerateDnssecKeysButton=element(by.buttonText('Regenerate DNSSEC Keys'));
+	this.regenerateKskButton=element(by.buttonText('Regenerate KSK'));
+	this.generateButton=element(by.buttonText('Generate'));
 };
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/common/commonFunctions.js b/traffic_portal/test/end_to_end/common/commonFunctions.js
index ce22325..d56d1b5 100644
--- a/traffic_portal/test/end_to_end/common/commonFunctions.js
+++ b/traffic_portal/test/end_to_end/common/commonFunctions.js
@@ -39,4 +39,9 @@ module.exports = function() {
 			}
 		).join("");
 	}
+
+	this.random = (max) => {
+		return Math.round(Math.random() * max);   
+	}
+
 };


Mime
View raw message