Skip to content

Commit 8be5cfc

Browse files
any-sdk-feature-crash-guard
Summary: - Novel unsupported transform versions do not crash `stackql`, but rather give some error message. - Added robot test `Select Leveraging Unsupported Transform Does Not Cause a Crash`.
1 parent a996e82 commit 8be5cfc

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

test/registry/src/aws/v0.1.0/services/ec2.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45792,6 +45792,69 @@ components:
4579245792
insert: []
4579345793
update: []
4579445794
delete: []
45795+
volumes_poorly_presented:
45796+
id: aws.ec2.volumes_poorly_presented
45797+
name: volumes_poorly_presented
45798+
title: volumes_poorly_presented
45799+
methods:
45800+
describeVolumes:
45801+
config:
45802+
queryParamTranspose:
45803+
algorithm: AWSCanonical
45804+
requestTranslate:
45805+
algorithm: get_query_to_post_form_utf_8
45806+
pagination:
45807+
requestToken:
45808+
key: NextToken
45809+
location: query
45810+
responseToken:
45811+
key: $.next_page_token
45812+
location: body
45813+
operation:
45814+
$ref: '#/paths/~1?Action=DescribeVolumes&Version=2016-11-15/get'
45815+
response:
45816+
mediaType: application/xml
45817+
overrideMediaType: application/json
45818+
openAPIDocKey: '200'
45819+
objectKey: '$.line_items'
45820+
schema_override:
45821+
$ref: '#/components/schemas/DisplayVolumesSchema'
45822+
transform:
45823+
body: >
45824+
{
45825+
"next_page_token": {{with index . "DescribeVolumesResponse" "nextToken"}}{{printf "%q" .}}{{else}}null{{end}},
45826+
"line_items": [
45827+
{{- $items := index . "DescribeVolumesResponse" "volumeSet" "item" -}}
45828+
{{- if eq (printf "%T" $items) "map[string]interface {}" }}
45829+
{{template "volume" $items}}
45830+
{{- else }}
45831+
{{- range $i, $v := $items }}
45832+
{{- if $i}},{{end}}
45833+
{{template "volume" $v}}
45834+
{{- end }}
45835+
{{- end }}
45836+
]
45837+
}
45838+
{{define "volume"}}
45839+
{
45840+
"volume_id": {{printf "%q" (index . "volumeId")}},
45841+
"size": {{toInt (index . "size")}},
45842+
"snapshot_id": {{with index . "snapshotId"}}{{printf "%q" .}}{{else}}null{{end}},
45843+
"availability_zone": {{printf "%q" (index . "availabilityZone")}},
45844+
"status": {{printf "%q" (index . "status")}},
45845+
"create_time": {{printf "%q" (index . "createTime")}},
45846+
"volume_type": {{printf "%q" (index . "volumeType")}},
45847+
"encrypted": {{toBool (index . "encrypted")}},
45848+
"multi_attach_enabled": {{toBool (index . "multiAttachEnabled")}}
45849+
}
45850+
{{end}}
45851+
type: 'golang_template_mxj_v0.1.999'
45852+
sqlVerbs:
45853+
select:
45854+
- $ref: '#/components/x-stackQL-resources/volumes/methods/describeVolumes'
45855+
insert: []
45856+
update: []
45857+
delete: []
4579545858
volumes_modifications:
4579645859
name: volumes_modifications
4579745860
methods:

test/robot/functional/stackql_mocked_from_cmd_line.robot

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7831,6 +7831,23 @@ Select Star From Transformed XML Response Body
78317831
... stdout=${CURDIR}/tmp/Select-Star-From-Transformed-XML-Response-Body.tmp
78327832
... stderr=${CURDIR}/tmp/Select-Star-From-Transformed-XML-Response-Body-stderr.tmp
78337833

7834+
Select Leveraging Unsupported Transform Does Not Cause a Crash
7835+
${inputStr} = Catenate
7836+
... select * from aws.ec2.volumes_poorly_presented where region = 'ap-southeast-2' order by volume_id;
7837+
Should Stackql Exec Inline Equal Both Streams
7838+
... ${STACKQL_EXE}
7839+
... ${OKTA_SECRET_STR}
7840+
... ${GITHUB_SECRET_STR}
7841+
... ${K8S_SECRET_STR}
7842+
... ${REGISTRY_NO_VERIFY_CFG_STR}
7843+
... ${AUTH_CFG_STR}
7844+
... ${SQL_BACKEND_CFG_STR_CANONICAL}
7845+
... ${inputStr}
7846+
... ${EMPTY}
7847+
... error processing response: invalid character '<' looking for beginning of value
7848+
... stdout=${CURDIR}/tmp/Select-Star-From-Transformed-XML-Response-Body.tmp
7849+
... stderr=${CURDIR}/tmp/Select-Star-From-Transformed-XML-Response-Body-stderr.tmp
7850+
78347851
Select Projection From Transformed XML Response Body
78357852
${inputStr} = Catenate
78367853
... select volume_id, create_time, region, size from aws.ec2.volumes_presented where region = 'ap-southeast-2' order by volume_id;

0 commit comments

Comments
 (0)