builtins actionSetFromTable

Edge Case: Recovery After Attempting to Load from a Non-Existent Table

Scénario de test & Cas d'usage

Business Context

An automated script attempts to load a user-defined action set. The script must be robust enough to handle cases where the source table does not exist (e.g., it was not created or was deleted) and then proceed correctly once the source is available.
About the Set : builtins

Fundamental CAS server system commands.

Discover all actions of builtins
Data Preparation

For this scenario, no initial data prep is needed. The test will begin by attempting to load from a table that has not been created yet. The table will be created mid-test.

Copied!
1/* No
2data prep needed. The test starts with a failure condition. */

Étapes de réalisation

1
Attempt to restore an action set from a table named 'non_existent_table' that does not exist. This step is expected to fail.
Copied!
1PROC CAS;
2 BUILTINS.actionSetFromTable /
3 TABLE={name='non_existent_table', caslib='CASUSER'};
4RUN;
5QUIT;
2
Simulate recovery: now, properly define and save the required action set ('emergency_tools') to its source table ('emergency_repo').
Copied!
1PROC CAS;
2 BUILTINS.defineActionSet / name='emergency_tools', actions={{name='ping', definition={code='print("Ping successful.");'}}};
3 RUN;
4 BUILTINS.actionSetToTable / actionSet='emergency_tools', TABLE={name='emergency_repo', caslib='CASUSER', replace=true};
5RUN;
6QUIT;
3
Re-attempt the load, this time from the correct, now-existing table 'emergency_repo'.
Copied!
1PROC CAS;
2 BUILTINS.actionSetFromTable /
3 TABLE={name='emergency_repo', caslib='CASUSER'};
4RUN;
4
Verify that the 'emergency_tools' action set was successfully loaded after the recovery.
Copied!
1PROC CAS;
2 BUILTINS.actionSetInfo / actionSet='emergency_tools';
3RUN;
4QUIT;

Expected Result


The first step must generate an error in the CAS log, indicating the source table was not found. After the table is created in step 2, the action in step 3 should execute successfully. The final verification in step 4 will confirm that the 'emergency_tools' action set is loaded, demonstrating the system's ability to recover from an initial failure.