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

Feature/self codes #156

Merged
merged 12 commits into from
Dec 1, 2023
Merged

Feature/self codes #156

merged 12 commits into from
Dec 1, 2023

Conversation

ajshedivy
Copy link
Collaborator

@ajshedivy ajshedivy commented Oct 16, 2023

Test Script:

-- SETUP, run once
CREATE SCHEMA SELFTEST
CREATE OR REPLACE TABLE SELFTEST.MYTBL (C1 INT, C2 VARCHAR(100), C3 TIMESTAMP, C4 DATE)
CREATE OR REPLACE TABLE SELFTEST.MYTBL2 (C1 INT, C2 VARCHAR(100), C3 TIMESTAMP, C4 DATE)
INSERT INTO SELFTEST.MYTBL VALUES (0, 'ADAM', CURRENT TIMESTAMP, CURRENT DATE)
INSERT INTO SELFTEST.MYTBL VALUES (1, 'LIAM', CURRENT TIMESTAMP + 1 SECOND, CURRENT DATE + 1 DAY)
INSERT INTO SELFTEST.MYTBL VALUES (2, 'RYAN', CURRENT TIMESTAMP + 2 SECOND, CURRENT DATE + 2 DAY)
INSERT INTO SELFTEST.MYTBL VALUES (3, NULL, CURRENT TIMESTAMP + 2 SECOND, CURRENT DATE + 2 DAY)

INSERT INTO SELFTEST.MYTBL2 VALUES (0, 'TIM', CURRENT TIMESTAMP, CURRENT DATE)
INSERT INTO SELFTEST.MYTBL2 VALUES (1, 'SCOTT', CURRENT TIMESTAMP + 1 SECOND, CURRENT DATE + 1 DAY)
INSERT INTO SELFTEST.MYTBL2 VALUES (2, 'JESSIE', CURRENT TIMESTAMP + 2 SECOND, CURRENT DATE + 2 DAY)
STOP

SET SCHEMA SELFTEST

-- SQL0138, get left-most 1001 characters of C2. C2 is only 100 characters long, so SQL0138 is produced
SELECT LEFT(C2, 1001) FROM SELFTEST.MYTBL

-- SQL0180, invalid format for date given
VALUES DATE('120-1231-12312')

-- SQL0181, valid format for date given, but the date doesn't exist
VALUES DATE('2023-45-45')

-- SQL0182, valid datetime exists, but context in which the timestamp is used is invalid (dividing int by timestamp doesn't make sense)
SELECT C3/C4 FROM SELFTEST.MYTBL

-- SQL0199, invalid syntax, missing predicate after WHERE and before ORDER BY
SELECT * FROM SELFTEST.MYTBL WHERE ORDER BY C1

-- SQL0203, C2 doesn't have a table name associated with it (T1 or T2), the database doesn't know what C2 to select
SELECT SELFTEST.MYTBL.C2 FROM SELFTEST.MYTBL T1
JOIN SELFTEST.MYTBL2 T2 ON
T1.C1 = T2.C1

-- SQL0204, trying to select from a table that doesn't exist
SELECT * FROM NOEXIST

-- SQL0206, column doesn't exist (but the table does)
SELECT NOCOL FROM SELFTEST.MYTBL

-- SQL0420, can't cast varchar to int
SELECT CAST(SELFTEST.MYTBL.C2 AS INT) FROM SELFTEST.MYTBL

-- SQL0551, user profile NOGOOD has no authority to access database file
CL: CRTUSRPRF USRPRF(NOGOOD)
SET SESSION AUTHORIZATION NOGOOD -- Swap to user profile with no permissions
SELECT * FROM SELFTEST.MYTBL2

DISCONNECT CURRENT -- Can't swap back to your normal profile once you've given up permissions, need to disconnect and reconnect
SET SCHEMA SELFTEST
CL: DLTUSRPRF USRPRF(NOGOOD) -- Clean up

-- SQL0811, subquery in update returns multiple rows, database doesn't know what row to use for update. Subquery must be correlated
UPDATE SELFTEST.MYTBL SET C1 = (SELECT C1 FROM SELFTEST.MYTBL2)



@ajshedivy ajshedivy requested a review from worksofliam October 16, 2023 20:18
@github-actions
Copy link

👋 A new build is available for this PR based on 40fa092.

@github-actions
Copy link

👋 A new build is available for this PR based on cbfe95e.

@ajshedivy
Copy link
Collaborator Author

Added testing framework for self codes. We can add more as we please

Copy link
Contributor

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Initial reaction is good. I am currently looking for a system to do tests on (my 7.3 box won't cut it).

In the mean time, the first thing to change is any reference of "SELFCODES" in labels to be "SELF codes"/"SELF code".

src/views/jobManager/selfCodes/selfCodesBrowser.ts Outdated Show resolved Hide resolved
src/views/jobManager/jobManagerView.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
worksofliam

This comment was marked as spam.

Copy link
Contributor

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Initial review is that it works, but the organisation of the 'set codes' method needs to be part of the SQL job and not a seperate function.

@github-actions
Copy link

👋 A new build is available for this PR based on ebcaf56.

@github-actions
Copy link

👋 A new build is available for this PR based on bd76b15.

@ajshedivy
Copy link
Collaborator Author

current testing state:

image

@github-actions
Copy link

👋 A new build is available for this PR based on ebb847e.

@github-actions
Copy link

👋 A new build is available for this PR based on 7c3126c.

@worksofliam worksofliam linked an issue Oct 20, 2023 that may be closed by this pull request
15 tasks
@github-actions
Copy link

👋 A new build is available for this PR based on 44ca294.

@ajshedivy ajshedivy marked this pull request as ready for review October 23, 2023 14:31
Copy link
Contributor

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Code looks good - just a couple of minor package.json changes, and perhaps some changing of the test cases is in order.

I actually think the SELF support should go into its own TestSuite instead of being part of the manager. Also, only some of the test cases are passing. What am I doing wrong? I am on a a 7.4 system. (oss74dev)

image

src/testing/manager.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@ajshedivy
Copy link
Collaborator Author

Code looks good - just a couple of minor package.json changes, and perhaps some changing of the test cases is in order.

I actually think the SELF support should go into its own TestSuite instead of being part of the manager. Also, only some of the test cases are passing. What am I doing wrong? I am on a a 7.4 system. (oss74dev)
image

hmm, interesting the tests look okay for me:

image

Copy link

👋 A new build is available for this PR based on 82d0b51.

Copy link

👋 A new build is available for this PR based on dfd8f68.

Copy link

👋 A new build is available for this PR based on 4e9890a.

Copy link
Contributor

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Thanks @ajshedivy - the tests are passing! Let's merge.

image

@worksofliam worksofliam merged commit c19d99a into main Dec 1, 2023
1 check passed
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.

Feature: Self Codes
2 participants