Skip to content

Commit

Permalink
Fix empty banner test (openconfig#3753)
Browse files Browse the repository at this point in the history
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
  • Loading branch information
dipchauh authored Feb 21, 2025
1 parent b9fa8d1 commit aecebfe
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ func TestMotdBanner(t *testing.T) {

t.Run("Get MOTD Config", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.LookupConfig(t, dut, config.Config()).Val(); ok && v != "" {
t.Errorf("MOTD Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
configGot := gnmi.Get(t, dut, config.Config())
Expand All @@ -73,10 +71,8 @@ func TestMotdBanner(t *testing.T) {

t.Run("Get MOTD Telemetry", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.Lookup(t, dut, state.State()).Val(); ok && v != "" {
t.Errorf("MOTD Telemetry Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
stateGot := gnmi.Get(t, dut, state.State())
Expand Down Expand Up @@ -124,10 +120,8 @@ func TestLoginBanner(t *testing.T) {

t.Run("Get Login Banner Config", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.LookupConfig(t, dut, config.Config()).Val(); ok && v != "" {
t.Errorf("Config Login Banner not empty")
} else {
t.Logf("No response for the path expected is expected as the config is empty")
}
} else {
configGot := gnmi.Get(t, dut, config.Config())
Expand All @@ -140,10 +134,8 @@ func TestLoginBanner(t *testing.T) {

t.Run("Get Login Banner Telemetry", func(t *testing.T) {
if testCase.banner == "" {
if gnmi.LookupConfig(t, dut, config.Config()).IsPresent() {
if v, ok := gnmi.Lookup(t, dut, state.State()).Val(); ok && v != "" {
t.Errorf("Telemetry Login Banner not empty")
} else {
t.Logf("No response for the path is expected as the config is empty")
}
} else {
stateGot := gnmi.Get(t, dut, state.State())
Expand Down

0 comments on commit aecebfe

Please sign in to comment.