From b70ee67c0dd31b32acf6d1c0146f7e196b5e0b67 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Wed, 17 Jul 2024 20:59:12 -0600 Subject: [PATCH] Test: add integration tests --- tests/all_inclusive/readme_quickstart.in | 25 +++++++++++++++++++++ tests/all_inclusive/readme_quickstart.out | 15 +++++++++++++ tests/for_loops/for_iter.in | 9 ++++++++ tests/for_loops/for_iter.out | 5 +++++ tests/for_loops/for_range.in | 9 ++++++++ tests/for_loops/for_range.out | 19 ++++++++++++++++ tests/for_loops/for_range_inc.in | 13 +++++++++++ tests/for_loops/for_range_inc.out | 16 +++++++++++++ tests/for_loops/mixed_for.in | 13 +++++++++++ tests/for_loops/mixed_for.out | 20 +++++++++++++++++ tests/ssh_props/case_insensitive.in | 5 +++++ tests/ssh_props/case_insensitive.out | 4 ++++ tests/ssh_props/multivalued.in | 6 +++++ tests/ssh_props/multivalued.out | 4 ++++ tests/ssh_props/ssh_props.in | 8 +++++++ tests/ssh_props/ssh_props.out | 6 +++++ tests/templates/multivalued_overwrite_1.in | 12 ++++++++++ tests/templates/multivalued_overwrite_1.out | 2 ++ tests/templates/multivalued_overwrite_2.in | 12 ++++++++++ tests/templates/multivalued_overwrite_2.out | 4 ++++ tests/templates/templates.in | 25 +++++++++++++++++++++ tests/templates/templates.out | 15 +++++++++++++ 22 files changed, 247 insertions(+) create mode 100644 tests/all_inclusive/readme_quickstart.in create mode 100644 tests/all_inclusive/readme_quickstart.out create mode 100644 tests/for_loops/for_iter.in create mode 100644 tests/for_loops/for_iter.out create mode 100644 tests/for_loops/for_range.in create mode 100644 tests/for_loops/for_range.out create mode 100644 tests/for_loops/for_range_inc.in create mode 100644 tests/for_loops/for_range_inc.out create mode 100644 tests/for_loops/mixed_for.in create mode 100644 tests/for_loops/mixed_for.out create mode 100644 tests/ssh_props/case_insensitive.in create mode 100644 tests/ssh_props/case_insensitive.out create mode 100644 tests/ssh_props/multivalued.in create mode 100644 tests/ssh_props/multivalued.out create mode 100644 tests/ssh_props/ssh_props.in create mode 100644 tests/ssh_props/ssh_props.out create mode 100644 tests/templates/multivalued_overwrite_1.in create mode 100644 tests/templates/multivalued_overwrite_1.out create mode 100644 tests/templates/multivalued_overwrite_2.in create mode 100644 tests/templates/multivalued_overwrite_2.out create mode 100644 tests/templates/templates.in create mode 100644 tests/templates/templates.out diff --git a/tests/all_inclusive/readme_quickstart.in b/tests/all_inclusive/readme_quickstart.in new file mode 100644 index 0000000..e42174e --- /dev/null +++ b/tests/all_inclusive/readme_quickstart.in @@ -0,0 +1,25 @@ +__preamble: + ssh_props: + Port: 22 + IdentitiesOnly: yes + ForwardX11: no + +############################################################################# +# Uni Computers +############################################################################# +__uni_template: + template: __preamble + ssh_props: + IdentityFile: ~/.ssh/id_ed25519 + User: emiliko + +ohaton: + template: __uni_template + ssh_props: + Hostname: ohaton.cs.ualberta.ca + +coronation: + # Using __uni_template here would make more sense, but ohaton works too + template: ohaton + ssh_props: + Hostname: coronation.cs.ualberta.ca diff --git a/tests/all_inclusive/readme_quickstart.out b/tests/all_inclusive/readme_quickstart.out new file mode 100644 index 0000000..0d64511 --- /dev/null +++ b/tests/all_inclusive/readme_quickstart.out @@ -0,0 +1,15 @@ +Host ohaton + ForwardX11 false + Hostname ohaton.cs.ualberta.ca + IdentitiesOnly true + IdentityFile ~/.ssh/id_ed25519 + Port 22 + User emiliko + +Host coronation + ForwardX11 false + Hostname coronation.cs.ualberta.ca + IdentitiesOnly true + IdentityFile ~/.ssh/id_ed25519 + Port 22 + User emiliko diff --git a/tests/for_loops/for_iter.in b/tests/for_loops/for_iter.in new file mode 100644 index 0000000..c547f71 --- /dev/null +++ b/tests/for_loops/for_iter.in @@ -0,0 +1,9 @@ +orca: + ssh_props: + Hostname: 10.42.43.1 + User: emiliko + for: + - variable: env + iter: ["FOO=bar", "BAR=foo"] + property: SendEnv + template: ${env} diff --git a/tests/for_loops/for_iter.out b/tests/for_loops/for_iter.out new file mode 100644 index 0000000..6c61f33 --- /dev/null +++ b/tests/for_loops/for_iter.out @@ -0,0 +1,5 @@ +Host orca + Hostname 10.42.43.1 + SendEnv BAR=foo + SendEnv FOO=bar + User emiliko diff --git a/tests/for_loops/for_range.in b/tests/for_loops/for_range.in new file mode 100644 index 0000000..d869ea6 --- /dev/null +++ b/tests/for_loops/for_range.in @@ -0,0 +1,9 @@ +orca: + ssh_props: + Hostname: 10.42.43.1 + User: emiliko + for: + - variable: port + range: [9026, 9042] + property: LocalForward + template: ${port} localhost:${port} diff --git a/tests/for_loops/for_range.out b/tests/for_loops/for_range.out new file mode 100644 index 0000000..9c455d4 --- /dev/null +++ b/tests/for_loops/for_range.out @@ -0,0 +1,19 @@ +Host orca + Hostname 10.42.43.1 + LocalForward 9026 localhost:9026 + LocalForward 9027 localhost:9027 + LocalForward 9028 localhost:9028 + LocalForward 9029 localhost:9029 + LocalForward 9030 localhost:9030 + LocalForward 9031 localhost:9031 + LocalForward 9032 localhost:9032 + LocalForward 9033 localhost:9033 + LocalForward 9034 localhost:9034 + LocalForward 9035 localhost:9035 + LocalForward 9036 localhost:9036 + LocalForward 9037 localhost:9037 + LocalForward 9038 localhost:9038 + LocalForward 9039 localhost:9039 + LocalForward 9040 localhost:9040 + LocalForward 9041 localhost:9041 + User emiliko diff --git a/tests/for_loops/for_range_inc.in b/tests/for_loops/for_range_inc.in new file mode 100644 index 0000000..6b1dd53 --- /dev/null +++ b/tests/for_loops/for_range_inc.in @@ -0,0 +1,13 @@ +orca: + ssh_props: + Hostname: 10.42.43.1 + User: emiliko + for: + - variable: port + range: [1026, 2042, 225] + property: LocalForward + template: ${port} localhost:${port} + - variable: port + range: [9026, 9042, 2] + property: LocalForward + template: ${port} localhost:${port} diff --git a/tests/for_loops/for_range_inc.out b/tests/for_loops/for_range_inc.out new file mode 100644 index 0000000..5bdeb01 --- /dev/null +++ b/tests/for_loops/for_range_inc.out @@ -0,0 +1,16 @@ +Host orca + Hostname 10.42.43.1 + LocalForward 1026 localhost:1026 + LocalForward 1251 localhost:1251 + LocalForward 1476 localhost:1476 + LocalForward 1701 localhost:1701 + LocalForward 1926 localhost:1926 + LocalForward 9026 localhost:9026 + LocalForward 9028 localhost:9028 + LocalForward 9030 localhost:9030 + LocalForward 9032 localhost:9032 + LocalForward 9034 localhost:9034 + LocalForward 9036 localhost:9036 + LocalForward 9038 localhost:9038 + LocalForward 9040 localhost:9040 + User emiliko diff --git a/tests/for_loops/mixed_for.in b/tests/for_loops/mixed_for.in new file mode 100644 index 0000000..3562a40 --- /dev/null +++ b/tests/for_loops/mixed_for.in @@ -0,0 +1,13 @@ +orca: + ssh_props: + Hostname: 10.42.43.1 + User: emiliko + for: + - variable: i + range: [1006, 1020] + property: LocalForward + template: ${i} localhost:${i} + - variable: enV + iter: ["FOO=bar", "BAR=foo", "BAZ=baz"] + property: SendEnv + template: ${enV} diff --git a/tests/for_loops/mixed_for.out b/tests/for_loops/mixed_for.out new file mode 100644 index 0000000..d6b9924 --- /dev/null +++ b/tests/for_loops/mixed_for.out @@ -0,0 +1,20 @@ +Host orca + Hostname 10.42.43.1 + LocalForward 1006 localhost:1006 + LocalForward 1007 localhost:1007 + LocalForward 1008 localhost:1008 + LocalForward 1009 localhost:1009 + LocalForward 1010 localhost:1010 + LocalForward 1011 localhost:1011 + LocalForward 1012 localhost:1012 + LocalForward 1013 localhost:1013 + LocalForward 1014 localhost:1014 + LocalForward 1015 localhost:1015 + LocalForward 1016 localhost:1016 + LocalForward 1017 localhost:1017 + LocalForward 1018 localhost:1018 + LocalForward 1019 localhost:1019 + SendEnv BAR=foo + SendEnv BAZ=baz + SendEnv FOO=bar + User emiliko diff --git a/tests/ssh_props/case_insensitive.in b/tests/ssh_props/case_insensitive.in new file mode 100644 index 0000000..2cf067d --- /dev/null +++ b/tests/ssh_props/case_insensitive.in @@ -0,0 +1,5 @@ +ohaton: + ssh_props: + port: 22 + identitiesonly: yes + forwardx11: no diff --git a/tests/ssh_props/case_insensitive.out b/tests/ssh_props/case_insensitive.out new file mode 100644 index 0000000..d2f14de --- /dev/null +++ b/tests/ssh_props/case_insensitive.out @@ -0,0 +1,4 @@ +Host ohaton + forwardx11 false + identitiesonly true + port 22 diff --git a/tests/ssh_props/multivalued.in b/tests/ssh_props/multivalued.in new file mode 100644 index 0000000..8fdf031 --- /dev/null +++ b/tests/ssh_props/multivalued.in @@ -0,0 +1,6 @@ +uni: + ssh_props: + LocalForward: + - 3306 localhost:3306 + - 3302 localhost:3302 + - 3000 localhost:3000 diff --git a/tests/ssh_props/multivalued.out b/tests/ssh_props/multivalued.out new file mode 100644 index 0000000..bc22500 --- /dev/null +++ b/tests/ssh_props/multivalued.out @@ -0,0 +1,4 @@ +Host uni + LocalForward 3000 localhost:3000 + LocalForward 3302 localhost:3302 + LocalForward 3306 localhost:3306 diff --git a/tests/ssh_props/ssh_props.in b/tests/ssh_props/ssh_props.in new file mode 100644 index 0000000..9237b96 --- /dev/null +++ b/tests/ssh_props/ssh_props.in @@ -0,0 +1,8 @@ +github.com: + ssh_props: + Hostname: github.com + IdentityFile: ~/.ssh/github_main + LocalForward: + - 3306 localhost:3306 + - 3302 localhost:3302 + - 3000 localhost:3000 diff --git a/tests/ssh_props/ssh_props.out b/tests/ssh_props/ssh_props.out new file mode 100644 index 0000000..45abf71 --- /dev/null +++ b/tests/ssh_props/ssh_props.out @@ -0,0 +1,6 @@ +Host github.com + Hostname github.com + IdentityFile ~/.ssh/github_main + LocalForward 3000 localhost:3000 + LocalForward 3302 localhost:3302 + LocalForward 3306 localhost:3306 diff --git a/tests/templates/multivalued_overwrite_1.in b/tests/templates/multivalued_overwrite_1.in new file mode 100644 index 0000000..fc76328 --- /dev/null +++ b/tests/templates/multivalued_overwrite_1.in @@ -0,0 +1,12 @@ +__uni: + ssh_props: + LocalForward: + - 3306 localhost:3306 + - 3302 localhost:3302 + - 3000 localhost:3000 + +ohaton: + template: __uni + ssh_props: + LocalForward: + - 9000 localhost:9000 diff --git a/tests/templates/multivalued_overwrite_1.out b/tests/templates/multivalued_overwrite_1.out new file mode 100644 index 0000000..ddb14c7 --- /dev/null +++ b/tests/templates/multivalued_overwrite_1.out @@ -0,0 +1,2 @@ +Host ohaton + LocalForward 9000 localhost:9000 diff --git a/tests/templates/multivalued_overwrite_2.in b/tests/templates/multivalued_overwrite_2.in new file mode 100644 index 0000000..980cbb1 --- /dev/null +++ b/tests/templates/multivalued_overwrite_2.in @@ -0,0 +1,12 @@ +__uni: + ssh_props: + LocalForward: + - 9000 localhost:9000 + +ohaton: + template: __uni + ssh_props: + LocalForward: + - 3306 localhost:3306 + - 3302 localhost:3302 + - 3000 localhost:3000 diff --git a/tests/templates/multivalued_overwrite_2.out b/tests/templates/multivalued_overwrite_2.out new file mode 100644 index 0000000..1060b62 --- /dev/null +++ b/tests/templates/multivalued_overwrite_2.out @@ -0,0 +1,4 @@ +Host ohaton + LocalForward 3000 localhost:3000 + LocalForward 3302 localhost:3302 + LocalForward 3306 localhost:3306 diff --git a/tests/templates/templates.in b/tests/templates/templates.in new file mode 100644 index 0000000..e42174e --- /dev/null +++ b/tests/templates/templates.in @@ -0,0 +1,25 @@ +__preamble: + ssh_props: + Port: 22 + IdentitiesOnly: yes + ForwardX11: no + +############################################################################# +# Uni Computers +############################################################################# +__uni_template: + template: __preamble + ssh_props: + IdentityFile: ~/.ssh/id_ed25519 + User: emiliko + +ohaton: + template: __uni_template + ssh_props: + Hostname: ohaton.cs.ualberta.ca + +coronation: + # Using __uni_template here would make more sense, but ohaton works too + template: ohaton + ssh_props: + Hostname: coronation.cs.ualberta.ca diff --git a/tests/templates/templates.out b/tests/templates/templates.out new file mode 100644 index 0000000..0d64511 --- /dev/null +++ b/tests/templates/templates.out @@ -0,0 +1,15 @@ +Host ohaton + ForwardX11 false + Hostname ohaton.cs.ualberta.ca + IdentitiesOnly true + IdentityFile ~/.ssh/id_ed25519 + Port 22 + User emiliko + +Host coronation + ForwardX11 false + Hostname coronation.cs.ualberta.ca + IdentitiesOnly true + IdentityFile ~/.ssh/id_ed25519 + Port 22 + User emiliko