11tests :
22 - name : " Transform job create tests"
3- description : " Part of transform job CRD tests. "
3+ description : " Testing the Create operation "
44 scenarios :
5- - name : " Create=InvalidInput"
6- description : " Given one of the parameters is invalid, ko.Status shows a terminal condition"
7- given :
8- desired_state : " transform_job/v1alpha1/transformj_invalid_before_create.yaml"
9- svc_api :
10- - operation : CreateTransformJobWithContext
11- error :
12- code : InvalidParameterValue
13- message : " The transform job name must not include a special character."
14- invoke : Create
15- expect :
16- latest_state : " transform_job/v1alpha1/transformj_invalid_create_attempted.yaml"
17- error : resource is in terminal condition
5+ - name : " Create=InvalidInput"
6+ description : " Given one of the parameters is invalid, ko.Status shows a terminal condition"
7+ given :
8+ desired_state : " v1alpha1/create/desired/invalid_before_create.yaml"
9+ svc_api :
10+ - operation : CreateTransformJobWithContext
11+ error :
12+ code : InvalidParameterValue
13+ message : " The transform job name must not include a special character."
14+ invoke : Create
15+ expect :
16+ latest_state : " v1alpha1/create/observed/invalid_create_attempted.yaml"
17+ error : resource is in terminal condition
18+ - name : " Create=Valid"
19+ description : " Create a new transform job successfully (ARN in status)."
20+ given :
21+ desired_state : " v1alpha1/create/desired/success_before_create.yaml"
22+ svc_api :
23+ - operation : CreateTransformJobWithContext
24+ output_fixture : " sdkapi/create/success_create.json"
25+ invoke : Create
26+ expect :
27+ latest_state : " v1alpha1/create/observed/success_after_create.yaml"
28+ error : nil
29+ - name : " Transform job readOne tests"
30+ description : " Testing the readOne operation"
31+ scenarios :
32+ - name : " ReadOne=MissingRequiredField"
33+ description : " Testing readOne when required field is missing. No API call is made and returns error."
34+ given :
35+ desired_state : " v1alpha1/readone/desired/missing_required_field.yaml"
36+ invoke : ReadOne
37+ expect :
38+ error : " resource not found"
39+ - name : " ReadOne=NotFound"
40+ description : " Testing readOne when Describe fails to find the resource on SageMaker"
41+ given :
42+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
43+ svc_api :
44+ - operation : DescribeTransformJobWithContext
45+ error :
46+ code : ValidationException
47+ message : " Could not find requested job with name"
48+ invoke : ReadOne
49+ expect :
50+ error : " resource not found"
51+ - name : " ReadOne=SuccessClearsConditions"
52+ description : Testing a successful reconciliation clears conditions if terminal/recoverable condition were already set to true
53+ given :
54+ desired_state : " v1alpha1/readone/desired/error_conditions_true.yaml"
55+ svc_api :
56+ - operation : DescribeTransformJobWithContext
57+ output_fixture : " sdkapi/describe/inprogress_describe.json"
58+ invoke : ReadOne
59+ expect :
60+ latest_state : " v1alpha1/readone/observed/conditions_clear_on_success.yaml"
61+ - name : " ReadOne=Fail"
62+ description : " This test checks if the condition is updated if describe fails and readOne returns error"
63+ given :
64+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
65+ svc_api :
66+ - operation : DescribeTransformJobWithContext
67+ error :
68+ code : ServiceUnavailable
69+ message : " Server is down"
70+ invoke : ReadOne
71+ expect :
72+ latest_state : " v1alpha1/readone/observed/error_on_describe.yaml"
73+ error : " ServiceUnavailable: Server is down\n\t status code: 0, request id: "
74+ - name : " ReadOne=AfterCreateInProgress"
75+ description : " Testing readOne right after create, the status should have ARN."
76+ given :
77+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
78+ svc_api :
79+ - operation : DescribeTransformJobWithContext
80+ output_fixture : " sdkapi/describe/inprogress_describe.json"
81+ invoke : ReadOne
82+ expect :
83+ latest_state : " v1alpha1/readone/observed/created.yaml"
84+ - name : " ReadOne=AfterCompletion"
85+ description : " Testing readOne after transform job completes, the status should have ARN."
86+ given :
87+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
88+ svc_api :
89+ - operation : DescribeTransformJobWithContext
90+ output_fixture : " sdkapi/describe/success_completed_describe.json"
91+ invoke : ReadOne
92+ expect :
93+ latest_state : " v1alpha1/readone/observed/completed.yaml"
94+ - name : " ReadOne=Stopping"
95+ description : " Testing readOne right after delete, the status should be in Stopping"
96+ given :
97+ desired_state : " v1alpha1/readone/desired/stopping.yaml"
98+ svc_api :
99+ - operation : DescribeTransformJobWithContext
100+ output_fixture : " sdkapi/describe/stopping_describe.json"
101+ invoke : ReadOne
102+ expect :
103+ latest_state : " v1alpha1/readone/observed/stopping.yaml"
104+ - name : " Transform job update tests"
105+ description : " Testing the Update operation"
106+ scenarios :
107+ - name : " Update=NotSupported"
108+ description : " This test checks if the controller throws error for update"
109+ given :
110+ desired_state : " v1alpha1/update/desired/updated_base.yaml"
111+ latest_state : " v1alpha1/create/observed/success_after_create.yaml"
112+ invoke : Update
113+ expect :
114+ latest_state : " v1alpha1/update/observed/error_on_update.yaml"
115+ error : " not implemented"
116+ - name : " Transform job delete tests"
117+ description : " Testing the delete operation"
118+ scenarios :
119+ - name : " Delete=Fail"
120+ description : " This test checks if the condition is updated if delete fails and returns error"
121+ given :
122+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
123+ svc_api :
124+ - operation : StopTransformJobWithContext
125+ error :
126+ code : ServiceUnavailable
127+ message : " Server is down"
128+ invoke : Delete
129+ expect :
130+ latest_state : " v1alpha1/delete/observed/error_on_delete.yaml"
131+ error : " ServiceUnavailable: Server is down\n\t status code: 0, request id: "
132+ - name : " Delete=Successful"
133+ description : " This test checks if the Transform job is deleted successfully"
134+ given :
135+ desired_state : " v1alpha1/readone/desired/after_create_inprogress.yaml"
136+ svc_api :
137+ - operation : StopTransformJobWithContext
138+ - operation : DescribeTransformJobWithContext
139+ error :
140+ code : ValidationException
141+ message : " Could not find requested job with name"
142+ invoke : Delete
143+ expect :
144+ error : nil
145+ - name : " Delete=MarkUnmanaged"
146+ description : " This test checks if the Transform job returns nil to mark the resource Unmanaged if job not in InProgress/Stopping state"
147+ given :
148+ desired_state : " v1alpha1/readone/observed/completed.yaml"
149+ svc_api :
150+ - operation : StopTransformJobWithContext
151+ invoke : Delete
152+ expect :
153+ error : nil
154+ - name : " Delete=RequeueDeleting"
155+ description : " This test checks if the Transform job requeues if job is in Stopping state"
156+ given :
157+ desired_state : " v1alpha1/readone/observed/stopping.yaml"
158+ svc_api :
159+ - operation : StopTransformJobWithContext
160+ invoke : Delete
161+ expect :
162+ error : TransformJob is Stopping.
0 commit comments