Skip to content

Commit

Permalink
Creating CLI e2e tests (#2494)
Browse files Browse the repository at this point in the history
* Moving CLI and Server external tests to 'testing' folder

* wip - First draft of e2e test

* Structuring tests

* Adding cli e2e tests on CI

* Fixing e2e tests

* Updating CI command

* Improved internal CLI e2e structure

* Update Github action script

* Fixing runtime

* Adding tests and fixing error on CLI

* Fixing apply command

* Fixing test behavior

* Fixing test

* Adding command to avoid test cache

* Fix datastore to consider new behavior

* Updated tests
  • Loading branch information
danielbdias authored May 12, 2023
1 parent c47f431 commit cb5e526
Show file tree
Hide file tree
Showing 33 changed files with 840 additions and 32 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,31 @@ jobs:
TEST_ENV="${{ matrix.test_env }}" \
./run.bash
e2e-cli:
name: CLI e2e tests
needs: [build-docker]
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: tracetest-go
path: dist/
- name: Run tests
run: |
find ./dist -name 'tracetest' -exec cp {} ./dist \;
chmod +x ./dist/tracetest
export TRACETEST_COMMAND=$PWD/dist/tracetest
export TEST_ENVIRONMENT=jaeger
export TAG=pr-${{ github.event.pull_request.number }}
cd ./testing/cli-e2etest
make test
deploy:
name: Deploy test infra
needs: [build-docker]
Expand Down
7 changes: 1 addition & 6 deletions cli/actions/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/kubeshop/tracetest/cli/openapi"
"github.com/kubeshop/tracetest/cli/utils"
"github.com/kubeshop/tracetest/server/model/yaml"
"github.com/mitchellh/mapstructure"
)

type dataStoreActions struct {
Expand Down Expand Up @@ -42,11 +41,7 @@ func (d dataStoreActions) GetID(file *file.File) (string, error) {
}

func (d *dataStoreActions) Apply(ctx context.Context, fileContent file.File) (result *file.File, err error) {
var dataStore openapi.DataStore
mapstructure.Decode(fileContent.Definition().Spec, &dataStore)

result, err = d.resourceClient.Update(ctx, fileContent, currentConfigID)
return result, err
return d.resourceClient.Update(ctx, fileContent, currentConfigID)
}

func (d *dataStoreActions) List(ctx context.Context, args utils.ListArgs) (*file.File, error) {
Expand Down
4 changes: 4 additions & 0 deletions cli/file/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func (f File) Contents() string {
return string(f.contents)
}

func (f File) ContentType() string {
return "text/yaml"
}

var (
hasIDRegex = regexp.MustCompile(`(?m:^\s+id:\s*[0-9a-zA-Z\-_]+$)`)
indentSizeRegex = regexp.MustCompile(`(?m:^(\s+)\w+)`)
Expand Down
4 changes: 2 additions & 2 deletions cli/formatters/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package formatters

import (
"github.com/alexeyco/simpletable"
"github.com/goccy/go-yaml"
"github.com/kubeshop/tracetest/cli/file"
"github.com/kubeshop/tracetest/cli/openapi"
)
Expand Down Expand Up @@ -54,9 +55,8 @@ func (f DatastoreFormatter) ToListTable(file *file.File) (*simpletable.Header, *

func (f DatastoreFormatter) ToStruct(file *file.File) (interface{}, error) {
var datastoreResource openapi.DataStoreResource
nullableDataStore := openapi.NewNullableDataStoreResource(&datastoreResource)

err := nullableDataStore.UnmarshalJSON([]byte(file.Contents()))
err := yaml.Unmarshal([]byte(file.Contents()), &datastoreResource)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cli/formatters/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package formatters
import (
"fmt"

"gopkg.in/yaml.v2"
"github.com/goccy/go-yaml"

"github.com/kubeshop/tracetest/cli/file"
)
Expand Down
8 changes: 6 additions & 2 deletions cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ require (
github.com/compose-spec/compose-go v1.5.1
github.com/cucumber/ci-environment/go v0.0.0-20220915001957-711b1c82415f
github.com/denisbrodbeck/machineid v1.0.1
github.com/joho/godotenv v1.3.0
github.com/goccy/go-yaml v1.11.0
github.com/kubeshop/tracetest/server v0.0.0-20230208220354-63c9594b2160
github.com/mitchellh/mapstructure v1.5.0
github.com/pterm/pterm v0.12.55
github.com/segmentio/analytics-go/v3 v3.2.1
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
go.uber.org/zap v1.23.0
Expand All @@ -30,6 +31,7 @@ require (
github.com/distribution/distribution/v3 v3.0.0-20220907155224-78b9c98c5c31 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fluidtruck/deepcopy v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
Expand All @@ -48,6 +50,8 @@ require (
github.com/knadh/koanf v1.4.3 // indirect
github.com/lithammer/fuzzysearch v1.1.5 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -67,7 +71,6 @@ require (
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All @@ -87,6 +90,7 @@ require (
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
google.golang.org/grpc v1.52.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
Expand Down
18 changes: 18 additions & 0 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fluidtruck/deepcopy v1.0.0 h1:StSep9r2WwYwDfoO7CWu1a8cZT5y3UUOelGxlSvFxIw=
github.com/fluidtruck/deepcopy v1.0.0/go.mod h1:AinXaEHc7itYqWSjX9OOwxBbM8/ELusxM8WSwP4RroM=
Expand All @@ -155,8 +157,13 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/goccy/go-yaml v1.11.0 h1:n7Z+zx8S9f9KgzG6KtQKf+kwqXZlLNR2F6018Dgau54=
github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down Expand Up @@ -317,18 +324,24 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubeshop/tracetest/server v0.0.0-20230208220354-63c9594b2160 h1:vSWsqho5dJxAJmrgKc1RClvjD4UpP9TlUNyCkiGkOnM=
github.com/kubeshop/tracetest/server v0.0.0-20230208220354-63c9594b2160/go.mod h1:fytz7/+EWBsIBNfS7MKrdDRQ2Dq4Ck+P2Z3jzvpDFY8=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/lithammer/fuzzysearch v1.1.5 h1:Ag7aKU08wp0R9QCfF4GoGST9HbmAIeLP7xwMrOBEp1c=
github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
Expand Down Expand Up @@ -525,6 +538,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -680,6 +694,8 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -762,6 +778,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
Expand Down
32 changes: 19 additions & 13 deletions cli/utils/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func GetAPIClient(cliConfig config.Config) *openapi.APIClient {
type ResourceClient struct {
Client http.Client
BaseUrl string
BaseHeader http.Header
ResourceType string
}

Expand All @@ -61,20 +60,15 @@ func GetResourceAPIClient(resourceType string, cliConfig config.Config) Resource
}

baseUrl := fmt.Sprintf("%s://%s/api/%s", cliConfig.Scheme, cliConfig.Endpoint, resourceType)
baseHeader := http.Header{
"x-client-id": []string{analytics.ClientID()},
"Content-Type": []string{"application/json"},
}

return ResourceClient{
Client: client,
BaseUrl: baseUrl,
BaseHeader: baseHeader,
ResourceType: resourceType,
}
}

func (resourceClient ResourceClient) NewRequest(url string, method string, body string) (*http.Request, error) {
func (resourceClient ResourceClient) NewRequest(url, method, body, contentType string) (*http.Request, error) {
var reqBody io.Reader
if body != "" {
reqBody = StringToIOReader(body)
Expand All @@ -85,13 +79,20 @@ func (resourceClient ResourceClient) NewRequest(url string, method string, body
return nil, err
}

request.Header = resourceClient.BaseHeader
if contentType == "" {
contentType = "application/json"
}

request.Header.Set("x-client-id", analytics.ClientID())
request.Header.Set("Content-Type", contentType)
request.Header.Set("Accept", contentType)

return request, err
}

func (resourceClient ResourceClient) Update(ctx context.Context, file file.File, ID string) (*file.File, error) {
url := fmt.Sprintf("%s/%s", resourceClient.BaseUrl, ID)
request, err := resourceClient.NewRequest(url, http.MethodPut, file.Contents())
request, err := resourceClient.NewRequest(url, http.MethodPut, file.Contents(), file.ContentType())
if err != nil {
return nil, fmt.Errorf("could not create request: %w", err)
}
Expand All @@ -117,14 +118,19 @@ func (resourceClient ResourceClient) Update(ctx context.Context, file file.File,
return nil, fmt.Errorf("invalid %s: %s", resourceClient.ResourceType, validationError)
}

responseContentType := resp.Header.Get("Content-type")
if responseContentType == "" {
responseContentType = "application/json"
}

file = file.SaveChanges(IOReadCloserToString(resp.Body))

return &file, nil
}

func (resourceClient ResourceClient) Delete(ctx context.Context, ID string) error {
url := fmt.Sprintf("%s/%s", resourceClient.BaseUrl, ID)
request, err := resourceClient.NewRequest(url, http.MethodDelete, "")
request, err := resourceClient.NewRequest(url, http.MethodDelete, "", "")
if err != nil {
return fmt.Errorf("could not delete resource: %w", err)
}
Expand All @@ -134,7 +140,7 @@ func (resourceClient ResourceClient) Delete(ctx context.Context, ID string) erro
}

func (resourceClient ResourceClient) Get(ctx context.Context, id string) (*file.File, error) {
request, err := resourceClient.NewRequest(fmt.Sprintf("%s/%s", resourceClient.BaseUrl, id), http.MethodGet, "")
request, err := resourceClient.NewRequest(fmt.Sprintf("%s/%s", resourceClient.BaseUrl, id), http.MethodGet, "", "")
if err != nil {
return nil, fmt.Errorf("could not create request: %w", err)
}
Expand Down Expand Up @@ -181,7 +187,7 @@ func parseListResponse(body string) (BaseListResponse, error) {

func (resourceClient ResourceClient) List(ctx context.Context, listArgs ListArgs) (*file.File, error) {
url := fmt.Sprintf("%s?skip=%d&take=%d&sortBy=%s&sortDirection=%s", resourceClient.BaseUrl, listArgs.Skip, listArgs.Take, listArgs.SortBy, listArgs.SortDirection)
request, err := resourceClient.NewRequest(url, http.MethodGet, "")
request, err := resourceClient.NewRequest(url, http.MethodGet, "", "")
if err != nil {
return nil, fmt.Errorf("could not create request: %w", err)
}
Expand Down Expand Up @@ -218,7 +224,7 @@ func (resourceClient ResourceClient) List(ctx context.Context, listArgs ListArgs
}

func (resourceClient ResourceClient) Create(ctx context.Context, file file.File) (*file.File, error) {
request, err := resourceClient.NewRequest(resourceClient.BaseUrl, http.MethodPost, file.Contents())
request, err := resourceClient.NewRequest(resourceClient.BaseUrl, http.MethodPost, file.Contents(), file.ContentType())
if err != nil {
return nil, fmt.Errorf("could not create request: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions go.work
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ go 1.20
use (
./cli
./server
./testing/cli-e2etest
)
Loading

0 comments on commit cb5e526

Please sign in to comment.