@@ -965,6 +965,102 @@ func TestResourceClusterUpdate(t *testing.T) {
965965 assert .Equal (t , "abc" , d .Id (), "Id should be the same as in reading" )
966966}
967967
968+ func TestResourceClusterUpdate_WhileScaling (t * testing.T ) {
969+ d , err := qa.ResourceFixture {
970+ Fixtures : []qa.HTTPFixture {
971+ {
972+ Method : "GET" ,
973+ Resource : "/api/2.1/clusters/get?cluster_id=abc" ,
974+ ReuseRequest : true ,
975+ Response : compute.ClusterDetails {
976+ ClusterId : "abc" ,
977+ NumWorkers : 100 ,
978+ ClusterName : "Shared Autoscaling" ,
979+ SparkVersion : "7.1-scala12" ,
980+ NodeTypeId : "i3.xlarge" ,
981+ AutoterminationMinutes : 15 ,
982+ State : compute .StateRunning ,
983+ },
984+ },
985+ {
986+ Method : "POST" ,
987+ Resource : "/api/2.1/clusters/events" ,
988+ ExpectedRequest : compute.GetEvents {
989+ ClusterId : "abc" ,
990+ Limit : 1 ,
991+ Order : compute .GetEventsOrderDesc ,
992+ EventTypes : []compute.EventType {compute .EventTypePinned , compute .EventTypeUnpinned },
993+ },
994+ Response : compute.GetEventsResponse {
995+ Events : []compute.ClusterEvent {},
996+ TotalCount : 0 ,
997+ },
998+ },
999+ {
1000+ Method : "POST" ,
1001+ Resource : "/api/2.1/clusters/start" ,
1002+ ExpectedRequest : compute.StartCluster {
1003+ ClusterId : "abc" ,
1004+ },
1005+ },
1006+ {
1007+ Method : "GET" ,
1008+ Resource : "/api/2.0/libraries/cluster-status?cluster_id=abc" ,
1009+ Response : compute.ClusterLibraryStatuses {
1010+ LibraryStatuses : []compute.LibraryFullStatus {},
1011+ },
1012+ },
1013+ {
1014+ Method : "POST" ,
1015+ Resource : "/api/2.1/clusters/edit" ,
1016+ ExpectedRequest : compute.ClusterDetails {
1017+ AutoterminationMinutes : 15 ,
1018+ ClusterId : "abc" ,
1019+ NumWorkers : 100 ,
1020+ ClusterName : "Shared Autoscaling" ,
1021+ SparkVersion : "7.1-scala12" ,
1022+ NodeTypeId : "i3.xlarge" ,
1023+ },
1024+ Response : common.APIErrorBody {
1025+ ErrorCode : "INVALID_STATE" ,
1026+ },
1027+ Status : 404 ,
1028+ },
1029+ {
1030+ Method : "POST" ,
1031+ Resource : "/api/2.1/clusters/edit" ,
1032+ ExpectedRequest : compute.ClusterDetails {
1033+ AutoterminationMinutes : 15 ,
1034+ ClusterId : "abc" ,
1035+ NumWorkers : 100 ,
1036+ ClusterName : "Shared Autoscaling" ,
1037+ SparkVersion : "7.1-scala12" ,
1038+ NodeTypeId : "i3.xlarge" ,
1039+ },
1040+ },
1041+ {
1042+ Method : "GET" ,
1043+ Resource : "/api/2.0/libraries/cluster-status?cluster_id=abc" ,
1044+ Response : compute.ClusterLibraryStatuses {
1045+ LibraryStatuses : []compute.LibraryFullStatus {},
1046+ },
1047+ },
1048+ },
1049+ ID : "abc" ,
1050+ Update : true ,
1051+ Resource : ResourceCluster (),
1052+ State : map [string ]any {
1053+ "autotermination_minutes" : 15 ,
1054+ "cluster_name" : "Shared Autoscaling" ,
1055+ "spark_version" : "7.1-scala12" ,
1056+ "node_type_id" : "i3.xlarge" ,
1057+ "num_workers" : 100 ,
1058+ },
1059+ }.Apply (t )
1060+ assert .NoError (t , err )
1061+ assert .Equal (t , "abc" , d .Id (), "Id should be the same as in reading" )
1062+ }
1063+
9681064func TestResourceClusterUpdateWithPinned (t * testing.T ) {
9691065 d , err := qa.ResourceFixture {
9701066 Fixtures : []qa.HTTPFixture {
0 commit comments