Skip to content

Reset cfg test#3

Draft
hellt wants to merge 6 commits intomainfrom
reset-cfg-test
Draft

Reset cfg test#3
hellt wants to merge 6 commits intomainfrom
reset-cfg-test

Conversation

@hellt
Copy link
Copy Markdown
Owner

@hellt hellt commented Aug 4, 2022

Hey @carlmontanari
I know you sup busy, so whenver you're there I'd appreaciate your expert opinion on a strange thing I see in scrapligo (v1.2.2) test.

Namely in this PR you see a newly added test function added called TestResetCfg which acts on an file input with send/recv chars.
The issue I am seeing is that scrapligo doesn't emit an error when the written bytes don't match the received ones.

Here is a snippet from the test execution with verbose logging:
go test -timeout 30s -v -run ^TestResetCfg$ github.com/openconfig/kne/topo/node/srl

/root/openconfig/kne/topo/node/srl/logging.go:54:     INFO SendCommand requested, sending 'load factory auto-commit'
    /root/openconfig/kne/topo/node/srl/logging.go:54:    DEBUG channel SendInput requested, sending input 'load factory auto-commit'
    /root/openconfig/kne/topo/node/srl/logging.go:54:    DEBUG channel write "load factory auto-commit"
    /root/openconfig/kne/topo/node/srl/logging.go:54:    DEBUG channel read " enter candidate private\n--{ candidate private private-admin }--[  ]--\nA:pod1# load factory auto-commit"
    /root/openconfig/kne/topo/node/srl/logging.go:54:    DEBUG channel write "\n"
    /root/openconfig/kne/topo/node/srl/logging.go:54:    DEBUG channel read "  \n/system/configuration/checkpoint[id=__factory__]:\n    Reverting to factory configuration\n\n/:\n    Preamble must be present in configuration file\n\n/:\n    Successfully reverted configuration\n\n--{ + candidate private private-admin }--[  ]--\nA:pod1#"
time="2022-08-04T16:38:52+02:00" level=info msg="pod1 - finished resetting config"

The bad stuff happens on line 3, where we write load factory auto-commit, but we read back some other line and no error is sent back.

Full log below

Details ``` Running tool: /root/sdk/go1.18.4/bin/go test -timeout 30s -run ^TestResetCfg$ github.com/openconfig/kne/topo/node/srl

=== RUN TestResetCfg
=== RUN TestResetCfg/success
time="2022-08-04T16:38:52+02:00" level=info msg="pod1 resetting config"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG opening connection to host 'pod1' on port '22'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG starting channel read loop
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG auth bypass is enabled, skipping in channel auth check
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO connection opened successfully
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO AcquirePriv requested, target privilege level 'exec'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel GetPrompt requested
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "Using configuration file(s): []\nWelcome to the srlinux CLI.\nType 'help' (and press ) if you need any help using this.\nWarning: Running in basic cli engine, only limited set of features is enabled.\n--{ running }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG AcquirePriv determined no privilege action necessary
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO SendCommand requested, sending 'environment cli-engine type basic'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'environment cli-engine type basic'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "environment cli-engine type basic"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " environment cli-engine type basic"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "\n--{ running }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO SendCommand requested, sending 'environment complete-on-space false'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'environment complete-on-space false'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "environment complete-on-space false"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " environment complete-on-space false"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "\n--{ + running }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO SendCommand requested, sending 'info from state system app-management application mgmt_server state | grep running'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'info from state system app-management application mgmt_server state | grep running'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "info from state system app-management application mgmt_server state | grep running"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " info from state system app-management application mgmt_server state | grep running"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "\n state running\n--{ running }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO SendCommand requested, sending 'info from state system configuration commit 1 status | grep complete'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'info from state system configuration commit 1 status | grep complete'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "info from state system configuration commit 1 status | grep complete"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " info from state system configuration commit 1 status | grep complete"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "\n status complete\n--{ running }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO SendCommand requested, sending 'load factory auto-commit'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'load factory auto-commit'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "load factory auto-commit"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " enter candidate private\n--{ candidate private private-admin }--[ ]--\nA:pod1# load factory auto-commit"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read " \n/system/configuration/checkpoint[id=factory]:\n Reverting to factory configuration\n\n/:\n Preamble must be present in configuration file\n\n/:\n Successfully reverted configuration\n\n--{ + candidate private private-admin }--[ ]--\nA:pod1#"
time="2022-08-04T16:38:52+02:00" level=info msg="pod1 - finished resetting config"
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO AcquirePriv requested, target privilege level 'exec'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel GetPrompt requested
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "\n"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel read "\n--{ + candidate private private-admin }--[ ]--\nA:pod1#"
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG AcquirePriv determined privilege de-escalation necessary
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel SendInput requested, sending input 'discard now'
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG channel write "discard now"
/root/openconfig/kne/topo/node/srl/logging.go:54: CRITICAL channel timeout sending input to device
/root/openconfig/kne/topo/node/srl/logging.go:54: CRITICAL error running network on close, error: errTimeoutError: channel timeout sending input to device
/root/openconfig/kne/topo/node/srl/logging.go:54: DEBUG closing connection to host 'pod1' on port '22'
/root/openconfig/kne/topo/node/srl/logging.go:54: INFO connection closed successfully
--- PASS: TestResetCfg (2.01s)
--- PASS: TestResetCfg/success (2.01s)
PASS
ok github.com/openconfig/kne/topo/node/srl 2.029s

</details>

@coveralls
Copy link
Copy Markdown

coveralls commented Aug 4, 2022

Pull Request Test Coverage Report for Build 2798317358

  • 14 of 20 (70.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 53.883%

Changes Missing Coverage Covered Lines Changed/Added Lines %
topo/node/srl/srl.go 14 20 70.0%
Totals Coverage Status
Change from base Build 2797510355: 0.05%
Covered Lines: 1908
Relevant Lines: 3541

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants