1- tests :
1+ tests :
22 - name : " Model package group create tests"
33 description : " Part of model package group CRD tests."
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 : " model_package_group/v1alpha1/mpg_invalid_before_create.yaml"
9- svc_api :
10- - operation : CreateModelPackageGroupWithContext
11- error :
12- code : InvalidParameterValue
13- message : " The model package group name must not include a special character."
14- invoke : Create
15- expect :
16- latest_state : " model_package_group/v1alpha1/mpg_invalid_create_attempted.yaml"
17- error : resource is in terminal condition
5+ - name : " Create=InvalidInput"
6+ description : " Given one of the parameters is invalid, Status shows a terminal condition"
7+ given :
8+ desired_state : " v1alpha1/create/desired/invalid_before_create.yaml"
9+ svc_api :
10+ - operation : CreateModelPackageGroupWithContext
11+ error :
12+ code : InvalidParameterValue
13+ message : " The model package group 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 model package group successfully (ARN in status)."
20+ given :
21+ desired_state : " v1alpha1/create/desired/success_before_create.yaml"
22+ svc_api :
23+ - operation : CreateModelPackageGroupWithContext
24+ output_fixture : " sdkapi/create/create_success.json"
25+ invoke : Create
26+ expect :
27+ latest_state : " v1alpha1/create/observed/success_after_create.yaml"
28+ error : nil
29+ - name : " Model package group 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.yaml"
43+ svc_api :
44+ - operation : DescribeModelPackageGroupWithContext
45+ error :
46+ code : ValidationException
47+ message : " Model package group xgboost-model-package-group does not exist."
48+ invoke : ReadOne
49+ expect :
50+ error : " resource not found"
51+ - name : " ReadOne=Fail"
52+ description : " This test checks if the condition is updated if describe fails and readOne returns error"
53+ given :
54+ desired_state : " v1alpha1/readone/desired/after_create.yaml"
55+ svc_api :
56+ - operation : DescribeModelPackageGroupWithContext
57+ error :
58+ code : ServiceUnavailable
59+ message : " Server is down"
60+ invoke : ReadOne
61+ expect :
62+ latest_state : " v1alpha1/readone/observed/error_on_describe.yaml"
63+ error : " ServiceUnavailable: Server is down\n\t status code: 0, request id: "
64+ - name : " ReadOne=Pending"
65+ description : " Testing readone right after create, the status should be in Pending with Resource synced being false."
66+ given :
67+ desired_state : " v1alpha1/readone/desired/pending_after_create.yaml"
68+ svc_api :
69+ - operation : DescribeModelPackageGroupWithContext
70+ output_fixture : " sdkapi/describe/describe_pending_after_create.json"
71+ invoke : ReadOne
72+ expect :
73+ latest_state : " v1alpha1/readone/observed/pending_after_create.yaml"
74+ - name : " ReadOne=Deleting"
75+ description : " Testing readone when deleting, resource synced should be false."
76+ given :
77+ desired_state : " v1alpha1/readone/desired/deleting.yaml"
78+ svc_api :
79+ - operation : DescribeModelPackageGroupWithContext
80+ output_fixture : " sdkapi/describe/describe_deleting.json"
81+ invoke : ReadOne
82+ expect :
83+ latest_state : " v1alpha1/readone/observed/deleting.yaml"
84+ - name : " ReadOne=InProgress"
85+ description : " Testing readone when inprogress, resource synced should be false."
86+ given :
87+ desired_state : " v1alpha1/readone/desired/inprogress_after_create.yaml"
88+ svc_api :
89+ - operation : DescribeModelPackageGroupWithContext
90+ output_fixture : " sdkapi/describe/describe_inprogress.json"
91+ invoke : ReadOne
92+ expect :
93+ latest_state : " v1alpha1/readone/observed/inprogess_after_create.yaml"
94+ - name : " ReadOne=AfterCreate"
95+ description : " Testing readOne after create, the status should have ARN."
96+ given :
97+ desired_state : " v1alpha1/readone/desired/after_create.yaml"
98+ svc_api :
99+ - operation : DescribeModelPackageGroupWithContext
100+ output_fixture : " sdkapi/describe/describe_success.json"
101+ invoke : ReadOne
102+ expect :
103+ latest_state : " v1alpha1/readone/observed/created.yaml"
104+ - name : " ReadOne=SuccessClearsConditions"
105+ description : " Testing a successful reconciliation clears conditions if terminal/recoverable condition were already set to true"
106+ given :
107+ desired_state : " v1alpha1/readone/desired/error_conditions_true.yaml"
108+ svc_api :
109+ - operation : DescribeModelPackageGroupWithContext
110+ output_fixture : " sdkapi/describe/describe_success.json"
111+ invoke : ReadOne
112+ expect :
113+ latest_state : " v1alpha1/readone/observed/conditions_clear_on_success.yaml"
114+ - name : " Model package group update tests"
115+ description : " Testing the Update operation"
116+ scenarios :
117+ - name : " Update=NotSupported"
118+ description : " This test checks if the controller throws error for update"
119+ given :
120+ desired_state : " v1alpha1/update/desired/updated_base.yaml"
121+ latest_state : " v1alpha1/readone/desired/after_create.yaml"
122+ invoke : Update
123+ expect :
124+ latest_state : " v1alpha1/update/observed/error_on_update.yaml"
125+ error : " not implemented"
126+ - name : " Model package group delete tests"
127+ description : " Testing the delete operation"
128+ scenarios :
129+ - name : " Delete=Fail"
130+ description : " This test checks if the condition is updated if delete fails and returns error"
131+ given :
132+ desired_state : " v1alpha1/readone/desired/after_create.yaml"
133+ svc_api :
134+ - operation : DeleteModelPackageGroupWithContext
135+ error :
136+ code : ServiceUnavailable
137+ message : " Server is down"
138+ invoke : Delete
139+ expect :
140+ latest_state : " v1alpha1/delete/observed/error_on_delete.yaml"
141+ error : " ServiceUnavailable: Server is down\n\t status code: 0, request id: "
142+ - name : " Delete=Successful"
143+ description : " This test checks if the Model package group is deleted successfully"
144+ given :
145+ desired_state : " v1alpha1/readone/desired/after_create.yaml"
146+ svc_api :
147+ - operation : DeleteModelPackageGroupWithContext
148+ - operation : DescribeModelPackageGroupWithContext
149+ error :
150+ code : ValidationException
151+ message : " Model package group xgboost-model-package-group does not exist."
152+ invoke : Delete
153+ expect :
154+ error : nil
155+ - name : " Delete=InProgress"
156+ description : " This test checks if the Model Package Group requeues while deleting. It should return a requeueWaitWhileStopping error."
157+ given :
158+ desired_state : " v1alpha1/delete/desired/delete_inprogress.yaml"
159+ svc_api :
160+ - operation : DeleteModelPackageGroupWithContext
161+ invoke : Delete
162+ expect :
163+ error : " ModelPackageGroup in InProgress state cannot be modified or deleted."
164+ - name : " Delete=Deleting"
165+ description : " This test checks if the Model Package Group requeues while deleting. It should return a requeueWaitWhileDeleting error."
166+ given :
167+ desired_state : " v1alpha1/delete/desired/delete_deleting.yaml"
168+ invoke : Delete
169+ expect :
170+ error : " ModelPackageGroup in Deleting state cannot be modified or deleted."
171+ - name : " Delete=Pending"
172+ description : " This test checks if the Model Package Group requeues while in pending state."
173+ given :
174+ desired_state : " v1alpha1/delete/desired/delete_pending.yaml"
175+ invoke : Delete
176+ expect :
177+ error : " ModelPackageGroup in Pending state cannot be modified or deleted."
0 commit comments