Skip to content

Commit 27a7a83

Browse files
authored
sfc: Suppress capacity in preparation for v2 (#122)
* sfc: Suppress capacity in preparation for v2 * disable validation test * disable validation test * better skip check
1 parent ffcb421 commit 27a7a83

3 files changed

Lines changed: 9 additions & 57 deletions

File tree

.github/workflows/validation-sfcompute.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
SFCOMPUTE_API_KEY: ${{ secrets.SFCOMPUTE_API_KEY }}
4646
TEST_PRIVATE_KEY_BASE64: ${{ secrets.TEST_PRIVATE_KEY_BASE64 }}
4747
TEST_PUBLIC_KEY_BASE64: ${{ secrets.TEST_PUBLIC_KEY_BASE64 }}
48-
VALIDATION_TEST: true
4948
run: |
5049
cd v1/providers/sfcompute
5150
go test -v -short=false -timeout=30m ./...

v1/providers/sfcompute/instancetype.go

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,9 @@ func makeDefaultInstanceTypePrice(amount string, currencyCode string) currency.A
3636
return instanceTypePrice
3737
}
3838

39-
func (c *SFCClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) {
40-
c.logger.Debug(ctx, "sfc: GetInstanceTypes start",
41-
v1.LogField("location", c.location),
42-
v1.LogField("args", fmt.Sprintf("%+v", args)),
43-
)
44-
45-
// Fetch all available zones
46-
includeUnavailable := false
47-
zones, err := c.getZones(ctx, includeUnavailable)
48-
if err != nil {
49-
return nil, err
50-
}
51-
52-
c.logger.Debug(ctx, "sfc: GetInstanceTypes zones list",
53-
v1.LogField("zone count", len(zones)),
54-
)
55-
56-
instanceTypes := make([]v1.InstanceType, 0, len(zones))
57-
for _, zone := range zones {
58-
gpuType := strings.ToLower(string(zone.HardwareType))
59-
60-
if !gpuTypeIsAllowed(gpuType) {
61-
c.logger.Debug(ctx, "sfc: GetInstanceTypes gpu type not allowed",
62-
v1.LogField("gpuType", gpuType),
63-
)
64-
continue
65-
}
66-
67-
instanceType, err := getInstanceTypeForZone(zone)
68-
if err != nil {
69-
return nil, err
70-
}
71-
72-
if !v1.IsSelectedByArgs(*instanceType, args) {
73-
c.logger.Debug(ctx, "sfc: GetInstanceTypes instance type not selected by args",
74-
v1.LogField("instanceType", instanceType.Type),
75-
)
76-
continue
77-
}
78-
79-
instanceTypes = append(instanceTypes, *instanceType)
80-
}
81-
82-
c.logger.Debug(ctx, "sfc: GetInstanceTypes end",
83-
v1.LogField("instanceType count", len(instanceTypes)),
84-
)
85-
86-
return instanceTypes, nil
39+
func (c *SFCClient) GetInstanceTypes(_ context.Context, _ v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) {
40+
// Artificially set capacity to 0 for all instance types
41+
return []v1.InstanceType{}, nil
8742
}
8843

8944
func getInstanceTypeForZone(zone sfcnodes.ZoneListResponseData) (*v1.InstanceType, error) {
@@ -148,10 +103,6 @@ func getInstanceTypeForZone(zone sfcnodes.ZoneListResponseData) (*v1.InstanceTyp
148103
return &instanceType, nil
149104
}
150105

151-
func gpuTypeIsAllowed(gpuType string) bool {
152-
return gpuType == gpuTypeH100 || gpuType == gpuTypeH200
153-
}
154-
155106
func makeInstanceTypeName(zone sfcnodes.ZoneListResponseData) string {
156107
interconnect := ""
157108
if strings.ToLower(zone.InterconnectType) == interconnectInfiniband {

v1/providers/sfcompute/validation_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ func TestInstanceLifecycleValidation(t *testing.T) {
3737
}
3838

3939
func checkSkip(t *testing.T) {
40-
apiKey := getAPIKey()
4140
isValidationTest := os.Getenv("VALIDATION_TEST")
42-
if apiKey == "" && isValidationTest != "" {
41+
if isValidationTest != "true" {
42+
t.Skip("VALIDATION_TEST is not set to true, skipping sfcompute validation tests")
43+
}
44+
45+
apiKey := getAPIKey()
46+
if apiKey == "" {
4347
t.Fatal("SFCOMPUTE_API_KEY not set, but VALIDATION_TEST is set")
44-
} else if apiKey == "" && isValidationTest == "" {
45-
t.Skip("SFCOMPUTE_API_KEY not set, skipping sfcompute validation tests")
4648
}
4749
}
4850

0 commit comments

Comments
 (0)