@@ -141,7 +141,7 @@ func TestDealAssignPickAndAlign(t *testing.T) {
141141 },
142142
143143 {
144- name : "deal limit" ,
144+ name : "deal count max limit" ,
145145 sectorSize : SectorSize2K ,
146146 sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
147147 spec : & mtypes.GetDealSpec {MaxPiece : 2 },
@@ -151,14 +151,74 @@ func TestDealAssignPickAndAlign(t *testing.T) {
151151 },
152152
153153 {
154- name : "deal size limit" ,
154+ name : "deal size max limit" ,
155155 sectorSize : SectorSize2K ,
156156 sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
157157 spec : & mtypes.GetDealSpec {MaxPieceSize : 256 },
158158 expectedDealIDs : []abi.DealID {isDeal , isDeal , isDeal , nonDeal , nonDeal , nonDeal },
159159 expectedPieceSize : []abi.PaddedPieceSize {128 , 128 , 128 , 128 , 512 , 1024 },
160160 expectedErr : nil ,
161161 },
162+
163+ {
164+ name : "deal size min limit, all good" ,
165+ sectorSize : SectorSize2K ,
166+ sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
167+ spec : & mtypes.GetDealSpec {MinPieceSize : 128 },
168+ expectedDealIDs : []abi.DealID {isDeal , isDeal , isDeal , nonDeal , isDeal , nonDeal },
169+ expectedPieceSize : []abi.PaddedPieceSize {128 , 128 , 128 , 128 , 512 , 1024 },
170+ expectedErr : nil ,
171+ },
172+
173+ {
174+ name : "deal size min limit 256" ,
175+ sectorSize : SectorSize2K ,
176+ sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
177+ spec : & mtypes.GetDealSpec {MinPieceSize : 256 },
178+ expectedDealIDs : []abi.DealID {isDeal , nonDeal , nonDeal },
179+ expectedPieceSize : []abi.PaddedPieceSize {512 , 512 , 1024 },
180+ expectedErr : nil ,
181+ },
182+
183+ {
184+ name : "deal min limit 4" ,
185+ sectorSize : SectorSize2K ,
186+ sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
187+ spec : & mtypes.GetDealSpec {MinPiece : 4 },
188+ expectedDealIDs : []abi.DealID {isDeal , isDeal , isDeal , nonDeal , isDeal , nonDeal },
189+ expectedPieceSize : []abi.PaddedPieceSize {128 , 128 , 128 , 128 , 512 , 1024 },
190+ expectedErr : nil ,
191+ },
192+
193+ {
194+ name : "deal min limit 5, empty" ,
195+ sectorSize : SectorSize2K ,
196+ sizes : []abi.PaddedPieceSize {128 , 128 , 128 , 512 },
197+ spec : & mtypes.GetDealSpec {MinPiece : 5 },
198+ expectedDealIDs : []abi.DealID {},
199+ expectedPieceSize : []abi.PaddedPieceSize {},
200+ expectedErr : nil ,
201+ },
202+
203+ {
204+ name : "space min limit 128" ,
205+ sectorSize : SectorSize2K ,
206+ sizes : []abi.PaddedPieceSize {128 , 256 },
207+ spec : nil ,
208+ expectedDealIDs : []abi.DealID {isDeal , nonDeal , isDeal , nonDeal , nonDeal },
209+ expectedPieceSize : []abi.PaddedPieceSize {128 , 128 , 256 , 512 , 1024 },
210+ expectedErr : nil ,
211+ },
212+
213+ {
214+ name : "space min limit 512, empty" ,
215+ sectorSize : SectorSize2K ,
216+ sizes : []abi.PaddedPieceSize {128 , 256 },
217+ spec : & mtypes.GetDealSpec {MinUsedSpace : 512 },
218+ expectedDealIDs : []abi.DealID {},
219+ expectedPieceSize : []abi.PaddedPieceSize {},
220+ expectedErr : nil ,
221+ },
162222 }
163223
164224 for ci := range cases {
0 commit comments