From 1d9c703a8eebcf8f328e610879c7a1799258bba3 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 4 Jul 2020 08:56:03 -0500 Subject: hscipt: Implement parse and validation of 'pppoe' key --- tests/fixtures/0241-pppoe-basic.installfile | 6 +++++ tests/fixtures/0242-pppoe-auth.installfile | 6 +++++ tests/fixtures/0243-pppoe-allkeys.installfile | 6 +++++ tests/fixtures/0244-pppoe-invalid.installfile | 6 +++++ tests/fixtures/0245-pppoe-valueless.installfile | 6 +++++ tests/spec/validator_spec.rb | 35 +++++++++++++++++++++++-- 6 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/0241-pppoe-basic.installfile create mode 100644 tests/fixtures/0242-pppoe-auth.installfile create mode 100644 tests/fixtures/0243-pppoe-allkeys.installfile create mode 100644 tests/fixtures/0244-pppoe-invalid.installfile create mode 100644 tests/fixtures/0245-pppoe-valueless.installfile (limited to 'tests') diff --git a/tests/fixtures/0241-pppoe-basic.installfile b/tests/fixtures/0241-pppoe-basic.installfile new file mode 100644 index 0000000..9e7d4e5 --- /dev/null +++ b/tests/fixtures/0241-pppoe-basic.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +pppoe eth0 diff --git a/tests/fixtures/0242-pppoe-auth.installfile b/tests/fixtures/0242-pppoe-auth.installfile new file mode 100644 index 0000000..250e820 --- /dev/null +++ b/tests/fixtures/0242-pppoe-auth.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +pppoe eth0 username=awilfox password=fuzzball diff --git a/tests/fixtures/0243-pppoe-allkeys.installfile b/tests/fixtures/0243-pppoe-allkeys.installfile new file mode 100644 index 0000000..6b70daa --- /dev/null +++ b/tests/fixtures/0243-pppoe-allkeys.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +pppoe eth0 username=awilfox password=fuzzball mtu=9001 lcp-echo-interval=10 lcp-echo-failure=5 diff --git a/tests/fixtures/0244-pppoe-invalid.installfile b/tests/fixtures/0244-pppoe-invalid.installfile new file mode 100644 index 0000000..8fc2768 --- /dev/null +++ b/tests/fixtures/0244-pppoe-invalid.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +pppoe eth0 cat=meow diff --git a/tests/fixtures/0245-pppoe-valueless.installfile b/tests/fixtures/0245-pppoe-valueless.installfile new file mode 100644 index 0000000..ee75450 --- /dev/null +++ b/tests/fixtures/0245-pppoe-valueless.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +pppoe eth0 username password=fuzzball diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index 8fb6c95..d2d121a 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -278,6 +278,37 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do expect(last_command_started).to have_output(/error: .*nameserver.*valid IPv6/) end end + context "for 'pppoe' key" do + it "succeeds with only an interface" do + use_fixture '0241-pppoe-basic.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with autnentication credentials" do + use_fixture '0242-pppoe-auth.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with all valid keys" do + use_fixture '0243-pppoe-allkeys.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "fails with an invalid key" do + use_fixture '0244-pppoe-invalid.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*pppoe.*invalid/) + end + it "succeeds with a value-less key" do + use_fixture '0245-pppoe-valueless.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + end context "for 'firmware' key" do it "always supports 'false' value" do use_fixture '0112-firmware-false.installfile' @@ -687,12 +718,12 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do run_validate expect(last_command_started).to have_output(/error: .*svcenable.*invalid/) end - it "succeeds with a runlevel specified" do + it "succeeds with a runlevel specified" do use_fixture '0239-svcenable-runlevel.installfile' run_validate expect(last_command_started).to have_output(PARSER_SUCCESS) expect(last_command_started).to have_output(VALIDATOR_SUCCESS) - end + end end context "for 'diskid' key" do it "succeeds with basic disk identification" do -- cgit v1.2.3-60-g2f50