Skip to content

Commit caadd43

Browse files
committed
fix test compute size
1 parent 7feb5e0 commit caadd43

File tree

6 files changed

+1241
-191
lines changed

6 files changed

+1241
-191
lines changed

internal/services/inference/deployment.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ func ResourceDeployment() *schema.Resource {
7070
"min_size": {
7171
Type: schema.TypeInt,
7272
Optional: true,
73+
Computed: true,
7374
Description: "The minimum size of the pool",
7475
},
7576
"max_size": {
7677
Type: schema.TypeInt,
7778
Optional: true,
79+
Computed: true,
7880
Description: "The maximum size of the pool",
7981
},
8082
"size": {
@@ -190,14 +192,6 @@ func ResourceDeploymentCreate(ctx context.Context, d *schema.ResourceData, m int
190192

191193
req.Endpoints = []*inference.EndpointSpec{&endpoint}
192194

193-
if maxSize, ok := d.GetOk("max_size"); ok {
194-
req.MaxSize = scw.Uint32Ptr(uint32(maxSize.(int)))
195-
}
196-
197-
if minSize, ok := d.GetOk("min_size"); ok {
198-
req.MaxSize = scw.Uint32Ptr(uint32(minSize.(int)))
199-
}
200-
201195
if isAcceptingEula, ok := d.GetOk("accept_eula"); ok {
202196
req.AcceptEula = scw.BoolPtr(isAcceptingEula.(bool))
203197
}
@@ -245,7 +239,7 @@ func ResourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m inter
245239
_ = d.Set("created_at", types.FlattenTime(deployment.CreatedAt))
246240
_ = d.Set("updated_at", types.FlattenTime(deployment.UpdatedAt))
247241

248-
if deployment.Endpoints[0].PrivateNetwork.PrivateNetworkID != "" {
242+
if deployment.Endpoints[0].PrivateNetwork != nil {
249243
_ = d.Set("endpoint_private_url", deployment.Endpoints[0].URL)
250244
_ = d.Set("endpoint_private_id", deployment.Endpoints[0].ID)
251245
_ = d.Set("disable_auth_private", deployment.Endpoints[0].DisableAuth)
@@ -255,7 +249,7 @@ func ResourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m inter
255249
_ = d.Set("disable_auth_public", deployment.Endpoints[0].DisableAuth)
256250
}
257251
if len(deployment.Endpoints) == 2 {
258-
if deployment.Endpoints[1].PrivateNetwork.PrivateNetworkID != "" {
252+
if deployment.Endpoints[1].PrivateNetwork != nil {
259253
_ = d.Set("endpoint_private_url", deployment.Endpoints[1].URL)
260254
_ = d.Set("endpoint_private_id", deployment.Endpoints[1].ID)
261255
_ = d.Set("disable_auth_private", deployment.Endpoints[1].DisableAuth)

internal/services/inference/deployment_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,37 +96,6 @@ func TestAccDeployment_Endpoint(t *testing.T) {
9696
})
9797
}
9898

99-
func TestAccDeployment_MinSize(t *testing.T) {
100-
tt := acctest.NewTestTools(t)
101-
defer tt.Cleanup()
102-
103-
resource.ParallelTest(t, resource.TestCase{
104-
PreCheck: func() { acctest.PreCheck(t) },
105-
ProviderFactories: tt.ProviderFactories,
106-
CheckDestroy: inferencetestfuncs.IsDeploymentDestroy(tt),
107-
Steps: []resource.TestStep{
108-
{
109-
Config: `
110-
resource "scaleway_inference_deployment" "main_size" {
111-
name = "test-inference-deployment-min-size"
112-
node_type = "L4"
113-
model_name = "meta/llama-3.1-8b-instruct:fp8"
114-
endpoints {
115-
public_endpoint = true
116-
}
117-
accept_eula = true
118-
min_size = 2
119-
}
120-
`,
121-
Check: resource.ComposeTestCheckFunc(
122-
testAccCheckDeploymentExists(tt, "scaleway_inference_deployment.main_size"),
123-
resource.TestCheckResourceAttr("scaleway_inference_deployment.main_size", "min_size", "2"),
124-
),
125-
},
126-
},
127-
})
128-
}
129-
13099
func testAccCheckDeploymentExists(tt *acctest.TestTools, n string) resource.TestCheckFunc {
131100
return func(state *terraform.State) error {
132101
rs, ok := state.RootModule().Resources[n]

0 commit comments

Comments
 (0)