Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dependencies #72

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/ninech/apis"
"github.com/ninech/nctl/api/log"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -56,12 +55,8 @@ func New(ctx context.Context, apiClusterContext, project string, opts ...ClientO
return nil, err
}

mapper := apis.StaticRESTMapper(scheme)
ctrox marked this conversation as resolved.
Show resolved Hide resolved
mapper.Add(corev1.SchemeGroupVersion.WithKind("Secret"), meta.RESTScopeNamespace)

c, err := runtimeclient.NewWithWatch(client.Config, runtimeclient.Options{
Scheme: scheme,
Mapper: mapper,
})
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion api/log/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestClient(t *testing.T) {
assert.Equal(t, fmt.Sprintf("%s %s\n", expectedTime.Local().Format(time.RFC3339), expectedLine), buf.String())
buf.Reset()

if err := c.TailQuery(ctx, 0, out, Query{Limit: 10}); err != nil {
if err := c.TailQuery(ctx, 0, out, Query{QueryString: "{app=\"test\"}", Limit: 10}); err != nil {
t.Fatal(err)
}
assert.Equal(t, fmt.Sprintf("%s %s\n", expectedTime.Local().Format(time.RFC3339), expectedLine), buf.String())
Expand Down
31 changes: 26 additions & 5 deletions api/log/fake.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package log

import (
"errors"
"net/http"
"net/http/httptest"
"net/url"
Expand All @@ -9,10 +10,12 @@ import (
"time"

"github.com/gorilla/websocket"
"github.com/grafana/loki/pkg/logcli/volume"
"github.com/grafana/loki/pkg/loghttp"
legacy "github.com/grafana/loki/pkg/loghttp/legacy"
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/util"
"github.com/grafana/loki/pkg/util/httpreq"
"github.com/grafana/loki/pkg/util/marshal"
)

Expand All @@ -32,6 +35,11 @@ func NewFake(t *testing.T, expectedTime time.Time, expectedLines ...string) *fak
func lokiTailHandler(t *testing.T, timestamp time.Time, lines []string) http.HandlerFunc {
upgrader := websocket.Upgrader{}
return func(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
t.Error(err)
return
}

req, err := loghttp.ParseTailQuery(r)
if err != nil {
t.Error(err)
Expand Down Expand Up @@ -64,7 +72,8 @@ func lokiTailHandler(t *testing.T, timestamp time.Time, lines []string) http.Han
},
}

if err := marshal.WriteTailResponseJSON(resp, c); err != nil {
connWriter := marshal.NewWebsocketJSONWriter(c)
if err := marshal.WriteTailResponseJSON(resp, connWriter, httpreq.ExtractEncodingFlags(r)); err != nil {
t.Error(err)
return
}
Expand Down Expand Up @@ -125,21 +134,33 @@ func (f fake) LiveTailQueryConn(queryStr string, delayFor time.Duration, limit i
}

func (f fake) ListLabelNames(quiet bool, start, end time.Time) (*loghttp.LabelResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}

func (f fake) ListLabelValues(name string, quiet bool, start, end time.Time) (*loghttp.LabelResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}

func (f fake) Series(matchers []string, start, end time.Time, quiet bool) (*loghttp.SeriesResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}

func (f fake) Query(queryStr string, limit int, time time.Time, direction logproto.Direction, quiet bool) (*loghttp.QueryResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}

func (f fake) GetOrgID() string {
return "fake"
}

func (f fake) GetStats(queryStr string, start, end time.Time, quiet bool) (*logproto.IndexStatsResponse, error) {
return nil, errors.New("not implemented")
}

func (f fake) GetVolume(query *volume.Query) (*loghttp.QueryResponse, error) {
return nil, errors.New("not implemented")
}

func (f fake) GetVolumeRange(query *volume.Query) (*loghttp.QueryResponse, error) {
return nil, errors.New("not implemented")
}
12 changes: 6 additions & 6 deletions create/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"

Check failure on line 25 in create/application_test.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: "k8s.io/utils/pointer" is deprecated: Use functions in k8s.io/utils/ptr instead: ptr.To to obtain a pointer, ptr.Deref to dereference a pointer, ptr.Equal to compare dereferenced pointers. (staticcheck)
)

const (
Expand Down Expand Up @@ -411,7 +411,7 @@
app.Status.AtProvider.Hosts = []apps.VerificationStatus{{Name: "host.example.org"}}
app.Status.AtProvider.CNAMETarget = "some.target.example.org"
app.Status.AtProvider.BasicAuthSecret = &meta.LocalReference{Name: basicAuth.Name}
if err := apiClient.Status().Update(ctx, app); err != nil {
ctrox marked this conversation as resolved.
Show resolved Hide resolved
if err := apiClient.Update(ctx, app); err != nil {
errors <- err
}

Expand All @@ -428,12 +428,12 @@
}

build.Status.AtProvider.BuildStatus = buildStatusRunning
if err := apiClient.Status().Update(ctx, build); err != nil {
if err := apiClient.Update(ctx, build); err != nil {
errors <- err
}

build.Status.AtProvider.BuildStatus = buildStatusSuccess
if err := apiClient.Status().Update(ctx, build); err != nil {
if err := apiClient.Update(ctx, build); err != nil {
errors <- err
}

Expand All @@ -442,7 +442,7 @@
}

release.Status.AtProvider.ReleaseStatus = releaseStatusAvailable
if err := apiClient.Status().Update(ctx, release); err != nil {
if err := apiClient.Update(ctx, release); err != nil {
errors <- err
}
}
Expand Down Expand Up @@ -525,7 +525,7 @@
}

build.Status.AtProvider.BuildStatus = buildStatusError
if err := client.Status().Update(ctx, build); err != nil {
if err := client.Update(ctx, build); err != nil {
errors <- err
}
}
Expand Down Expand Up @@ -553,5 +553,5 @@
}

mg.SetConditions(condition)
return apiClient.Status().Update(ctx, mg)
return apiClient.Update(ctx, mg)
}
2 changes: 1 addition & 1 deletion create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestCreate(t *testing.T) {
}

asa.SetConditions(runtimev1.Available())
if err := apiClient.Status().Update(ctx, asa); err != nil {
if err := apiClient.Update(ctx, asa); err != nil {
errChan <- err
}
}
Expand Down
2 changes: 1 addition & 1 deletion get/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dev
projects: test.Projects(organization, "dev", "staging"),
name: "dev",
outputFormat: yamlOut,
output: "kind: Project\napiVersion: management.nine.ch/v1alpha1\nmetadata:\n name: dev\n namespace: evilcorp\nspec: {}\n",
output: "kind: Project\napiVersion: management.nine.ch/v1alpha1\nmetadata:\n name: dev\n namespace: evilcorp\nspec:\n isNonProduction: false\n",
},
} {
t.Run(name, func(t *testing.T) {
Expand Down
Loading
Loading