Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reset ready timeout on successful connection #160

Merged
merged 8 commits into from
Mar 23, 2023
Merged

fix: reset ready timeout on successful connection #160

merged 8 commits into from
Mar 23, 2023

Conversation

smorrisj
Copy link
Contributor

@smorrisj smorrisj commented Mar 10, 2023

Summary
Correct the connection ready timeout to clear when a successful connection is made. The previous behavior was prematurely closing the ssh session because the timeout was firing even after a successful connection ready event was encountered. In the timeout function there is code to gracefully end the connection.

This behavior resulted in subsequent run button presses resetting/re-establishing the sas -nodms interactive session. When this happened any intermediate work table content was lost.

Testing (Developer)

  • Test via steps to reproduce:
    1. Connect to a 9.4 environment with a SAS 9.4 Remote connection profile.
    2. Place the following sas code in the editor contents:
    data test; set sashelp.class; run;
    3. Click run. Verify that no errors appear in the log.
    4. Replace editor contents with code that uses the work table:
    proc print data=test; run;
    5. Click run.
    6. Verify that proc print step from 4 prints the results from the work table to the log.
    7. Verify that result tab shows with 19 observations.
    8. Click the close button.
    9. Replace the editor contents with code from step 4.
    10. Click run.
    11. Verify that the intermediate work table is no longer found with error:
    File WORK.TEST.DATA does not exist.

  • Test that a sas program that runs for longer than the ready timeout (default 10) seconds value does not prematurely timeout. Program code:
    data _null_; slept=sleep(25,1); run;

  • Add appropriate unit tests

@smorrisj smorrisj linked an issue Mar 10, 2023 that may be closed by this pull request
@smorrisj
Copy link
Contributor Author

smorrisj commented Mar 10, 2023

Main issues are fixed. Working on how we might leverage the extension test api to test different aspects of the duplex stream on the ssh connection provider to shore up some coverage gaps.

* add sinon types to aid with type safety
* refactor contentdataprovider tests to use types
* add ts-sinon library to add with stubbing of interfaces
client/src/connection/ssh/index.ts Show resolved Hide resolved
client/src/connection/ssh/index.ts Outdated Show resolved Hide resolved
stream?.write(`%put ${endCode};\n`);
});
}
setTimer() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add method private/protected/etc to these methods to get a better idea of what's publicly accessible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, meant to do this as part of moving the logic into a class definition. Will add these.

client/src/connection/ssh/index.ts Outdated Show resolved Hide resolved
client/test/connection/ssh/index.test.ts Show resolved Hide resolved
client/test/utils.ts Show resolved Hide resolved
* use arrow functions
* visibility modifiers on class functions
* refactor listeners into discreet methods
Co-authored-by: Scott Dover <scott@scottdover.com>
@Becky-Williamson Becky-Williamson added testing-complete Complete the pull requests testing and removed testing Test the pull requests labels Mar 23, 2023
Co-authored-by: Scott Dover <scott@scottdover.com>
@smorrisj smorrisj merged commit 534f0b7 into main Mar 23, 2023
@smorrisj smorrisj deleted the bug/155 branch April 6, 2023 12:57
@Becky-Williamson Becky-Williamson added verified and removed testing-complete Complete the pull requests testing labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WORK tables are not persisted when connected with a 9.4 profile
4 participants