feat(Client): fix DeleteInstance
Some checks failed
Go Tests / go-tests (push) Failing after 59s

This commit is contained in:
Christopher Hase 2025-09-08 14:18:15 +02:00
parent a98c76ba84
commit ebd16d7c50
3 changed files with 22 additions and 3 deletions

View file

@ -1,6 +1,7 @@
organization = "edp-developer-framework"
region = "EU"
log_file = "./lala.log"
credentials_file = "/home/chris/ipcei/projects/garm-provider-edge-connect/config/creds.toml"
[cloudlet]
name = "Munich"

View file

@ -124,7 +124,7 @@ func (e *EdgeConnect) ShowApps(ctx context.Context, appkey AppKey, region string
return nil, err
}
if !responses.IsSuccessful() {
if !responses.IsSuccessful() && responses.StatusCode != http.StatusNotFound {
return nil, responses.Error()
}
@ -226,7 +226,7 @@ func (e *EdgeConnect) ShowAppInstances(ctx context.Context, appinstkey AppInstan
return nil, err
}
if !responses.IsSuccessful() {
if !responses.IsSuccessful() && responses.StatusCode != http.StatusNotFound {
return nil, responses.Error()
}
@ -278,6 +278,12 @@ func call[T any](ctx context.Context, client *EdgeConnect, path string, body []b
responses := Responses[T]{}
responses.StatusCode = resp.StatusCode
if resp.StatusCode == http.StatusNotFound {
log.Printf("Error in call %s: %v", path, ErrNotFound)
return responses, nil
}
decoder := json.NewDecoder(resp.Body)
for {
var d Response[T]
@ -285,7 +291,8 @@ func call[T any](ctx context.Context, client *EdgeConnect, path string, body []b
if err.Error() == "EOF" {
break
}
log.Fatal(err)
log.Printf("Error in call %s: %v", path, err)
return Responses[T]{}, fmt.Errorf("Error in call %s: %w", path, err)
}
responses.Responses = append(responses.Responses, d)
}

11
testdelete.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
export GARM_COMMAND="DeleteInstance"
export GARM_CONTROLLER_ID="50cb196d"
export GARM_INTERFACE_VERSION="v0.1.0"
export GARM_POOL_ID="50fa68a5"
export GARM_PROVIDER_CONFIG_FILE="/home/chris/ipcei/projects/garm-provider-edge-connect/config/config.toml"
export GARM_INSTANCE_ID="garm-FbqZV9JufazZ"
cat <<EOF | go run main.go
EOF