fix: more expressive errors (#22448)
* fix: more expressive errors Closes #22446 * fix: server only logging for untyped errors * chore: fix formattingpull/22465/head
parent
3e275a123d
commit
5015297d40
|
@ -4,9 +4,8 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -11,18 +11,17 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
itesting "github.com/influxdata/influxdb/v2/testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
)
|
||||
|
||||
type AuthedAuthorizationService struct {
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorization_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -13,6 +11,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2/authorization"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/inmem"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kv/migration/all"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/tenant"
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@ package authorization
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorization
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
// tenantService is a mock implementation of an authorization.tenantService
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/rand"
|
||||
)
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/snowflake"
|
||||
|
|
|
@ -4,11 +4,10 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
jsonp "github.com/influxdata/influxdb/v2/pkg/jsonparser"
|
||||
)
|
||||
|
|
|
@ -3,13 +3,13 @@ package authorization_test
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorization"
|
||||
"github.com/influxdata/influxdb/v2/inmem"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/kv/migration/all"
|
||||
"go.uber.org/zap/zaptest"
|
||||
|
|
|
@ -3,10 +3,9 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
// AuthAgent provides a means to authenticate users with resource and their associate actions. It
|
||||
|
|
|
@ -2,12 +2,12 @@ package authorizer_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
var _ influxdb.AuthorizationService = (*AuthorizationService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -4,11 +4,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
)
|
||||
|
||||
func isAllowedAll(a influxdb.Authorizer, permissions []influxdb.Permission) error {
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/notification/check"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.DashboardService = (*DashboardService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -4,9 +4,8 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.DocumentService = (*DocumentService)(nil)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.LabelService = (*LabelService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,10 +3,9 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
var _ influxdb.NotificationEndpointService = (*NotificationEndpointService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/notification/endpoint"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.NotificationRuleStore = (*NotificationRuleStore)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/notification/rule"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
|
|
|
@ -3,10 +3,9 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.OrganizationService = (*OrgService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
// PasswordService is a new authorization middleware for a password service.
|
||||
|
|
|
@ -2,12 +2,12 @@ package authorizer_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
@ -4,9 +4,8 @@ import (
|
|||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.ScraperTargetStoreService = (*ScraperTargetStoreService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.SecretService = (*SecretService)(nil)
|
||||
|
|
|
@ -3,14 +3,14 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.SourceService = (*SourceService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -6,13 +6,12 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_BackupSqlStore(t *testing.T) {
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.TelegrafConfigStore = (*TelegrafConfigService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
type OrgIDResolver interface {
|
||||
|
|
|
@ -2,14 +2,14 @@ package authorizer_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,10 +3,9 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
var _ influxdb.UserService = (*UserService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -3,9 +3,8 @@ package authorizer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.VariableService = (*VariableService)(nil)
|
||||
|
|
|
@ -3,8 +3,6 @@ package authorizer_test
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -12,6 +10,8 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -7,9 +7,8 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/rand"
|
||||
"github.com/influxdata/influxdb/v2/snowflake"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"math/rand"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -2,9 +2,9 @@ package bolt_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"testing"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ import (
|
|||
"strconv"
|
||||
"sync/atomic"
|
||||
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"github.com/influxdata/influx-cli/v2/clients"
|
||||
"github.com/influxdata/influx-cli/v2/pkg/stdio"
|
||||
"github.com/influxdata/influxdb/v2/logger"
|
||||
|
@ -22,6 +20,7 @@ import (
|
|||
"github.com/influxdata/influxdb/v2/tsdb/index/tsi1"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
|
|
|
@ -13,9 +13,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/cli"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
"github.com/influxdata/influxdb/v2/pkg/escape"
|
||||
"github.com/influxdata/influxdb/v2/tsdb/engine/tsm1"
|
||||
|
|
|
@ -8,10 +8,9 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/http"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
"github.com/influxdata/influxdb/v2/storage"
|
||||
|
|
|
@ -76,8 +76,12 @@ import (
|
|||
telegrafservice "github.com/influxdata/influxdb/v2/telegraf/service"
|
||||
"github.com/influxdata/influxdb/v2/telemetry"
|
||||
"github.com/influxdata/influxdb/v2/tenant"
|
||||
_ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1" // needed for tsm1
|
||||
_ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1" // needed for tsi1
|
||||
|
||||
// needed for tsm1
|
||||
_ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1"
|
||||
|
||||
// needed for tsi1
|
||||
_ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1"
|
||||
authv1 "github.com/influxdata/influxdb/v2/v1/authorization"
|
||||
iqlcoordinator "github.com/influxdata/influxdb/v2/v1/coordinator"
|
||||
"github.com/influxdata/influxdb/v2/v1/services/meta"
|
||||
|
@ -658,10 +662,11 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
|
|||
ts.BucketService = replications.NewBucketService(
|
||||
m.log.With(zap.String("service", "replication_buckets")), ts.BucketService, replicationSvc)
|
||||
|
||||
errorHandler := kithttp.NewErrorHandler(m.log.With(zap.String("handler", "error_logger")))
|
||||
m.apibackend = &http.APIBackend{
|
||||
AssetsPath: opts.AssetsPath,
|
||||
UIDisabled: opts.UIDisabled,
|
||||
HTTPErrorHandler: kithttp.ErrorHandler(0),
|
||||
HTTPErrorHandler: errorHandler,
|
||||
Logger: m.log,
|
||||
FluxLogEnabled: opts.FluxLogEnabled,
|
||||
SessionRenewDisabled: opts.SessionRenewDisabled,
|
||||
|
@ -720,7 +725,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) {
|
|||
WriteEventRecorder: infprom.NewEventRecorder("write"),
|
||||
QueryEventRecorder: infprom.NewEventRecorder("query"),
|
||||
Flagger: m.flagger,
|
||||
FlagsHandler: feature.NewFlagsHandler(kithttp.ErrorHandler(0), feature.ByKey),
|
||||
FlagsHandler: feature.NewFlagsHandler(errorHandler, feature.ByKey),
|
||||
}
|
||||
|
||||
m.reg.MustRegister(m.apibackend.PrometheusCollectors()...)
|
||||
|
|
|
@ -4,9 +4,8 @@ import (
|
|||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/cli"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
|
|
@ -15,8 +15,6 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/flux"
|
||||
"github.com/influxdata/flux/csv"
|
||||
"github.com/influxdata/flux/execute"
|
||||
|
@ -29,6 +27,7 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/cmd/influxd/launcher"
|
||||
phttp "github.com/influxdata/influxdb/v2/http"
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/influxdata/influxdb/v2/query"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -9,9 +9,8 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/v1/services/meta"
|
||||
"github.com/influxdata/influxql"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -8,12 +8,11 @@ import (
|
|||
"testing"
|
||||
"unsafe"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorization"
|
||||
"github.com/influxdata/influxdb/v2/inmem"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kv/migration"
|
||||
"github.com/influxdata/influxdb/v2/kv/migration/all"
|
||||
"github.com/influxdata/influxdb/v2/pkg/testing/assert"
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
|
|
@ -2,11 +2,11 @@ package context_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
func TestGetAuthorizer(t *testing.T) {
|
||||
|
|
|
@ -6,12 +6,11 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
influxdb "github.com/influxdata/influxdb/v2"
|
||||
icontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/feature"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/snowflake"
|
||||
)
|
||||
|
|
|
@ -6,13 +6,12 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/feature"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
)
|
||||
|
||||
// TODO(goller): remove opPrefix argument
|
||||
|
|
|
@ -7,12 +7,11 @@ import (
|
|||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -3,9 +3,8 @@ package dbrp
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ import (
|
|||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
)
|
||||
|
|
|
@ -2,13 +2,13 @@ package dbrp_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/dbrp"
|
||||
"github.com/influxdata/influxdb/v2/http"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
"go.uber.org/zap/zaptest"
|
||||
|
|
|
@ -5,12 +5,11 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -3,10 +3,9 @@ package dbrp
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var _ influxdb.DBRPMappingService = (*AuthorizedService)(nil)
|
||||
|
|
|
@ -2,14 +2,14 @@ package dbrp_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
influxdbcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/dbrp"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
)
|
||||
|
|
|
@ -6,10 +6,11 @@ package mocks
|
|||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
influxdb "github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// MockBucketService is a mock of BucketService interface
|
||||
|
|
|
@ -6,10 +6,11 @@ package mocks
|
|||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
influxdb "github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// MockDBRPMappingService is a mock of DBRPMappingService interface
|
||||
|
|
|
@ -29,9 +29,8 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/snowflake"
|
||||
)
|
||||
|
|
|
@ -8,9 +8,10 @@ package fluxinit
|
|||
|
||||
import (
|
||||
"github.com/influxdata/flux/runtime"
|
||||
|
||||
_ "github.com/influxdata/flux/stdlib"
|
||||
_ "github.com/influxdata/influxdb/v2/query/stdlib" // Import the stdlib
|
||||
|
||||
// Import the stdlib
|
||||
_ "github.com/influxdata/influxdb/v2/query/stdlib"
|
||||
)
|
||||
|
||||
// The FluxInit() function prepares the runtime for compilation and execution
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,10 +9,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -112,7 +112,7 @@ func TestAPIHandler_NotFound(t *testing.T) {
|
|||
w := httptest.NewRecorder()
|
||||
|
||||
b := &APIBackend{
|
||||
HTTPErrorHandler: kithttp.ErrorHandler(0),
|
||||
HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)),
|
||||
Logger: zaptest.NewLogger(t),
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,11 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
platcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -10,13 +10,12 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorization"
|
||||
pcontext "github.com/influxdata/influxdb/v2/context"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/kv"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
|
@ -336,7 +335,7 @@ func TestService_handleGetAuthorizations(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
authorizationBackend := NewMockAuthorizationBackend(t)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
authorizationBackend.AuthorizationService = tt.fields.AuthorizationService
|
||||
authorizationBackend.UserService = tt.fields.UserService
|
||||
authorizationBackend.OrganizationService = tt.fields.OrganizationService
|
||||
|
@ -521,7 +520,7 @@ func TestService_handleGetAuthorization(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
authorizationBackend := NewMockAuthorizationBackend(t)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
authorizationBackend.AuthorizationService = tt.fields.AuthorizationService
|
||||
authorizationBackend.UserService = tt.fields.UserService
|
||||
authorizationBackend.OrganizationService = tt.fields.OrganizationService
|
||||
|
@ -701,7 +700,7 @@ func TestService_handlePostAuthorization(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
authorizationBackend := NewMockAuthorizationBackend(t)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
authorizationBackend.AuthorizationService = tt.fields.AuthorizationService
|
||||
authorizationBackend.UserService = tt.fields.UserService
|
||||
authorizationBackend.OrganizationService = tt.fields.OrganizationService
|
||||
|
@ -815,7 +814,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
authorizationBackend := NewMockAuthorizationBackend(t)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
authorizationBackend.AuthorizationService = tt.fields.AuthorizationService
|
||||
authorizationBackend.UserService = tt.fields.UserService
|
||||
authorizationBackend.OrganizationService = tt.fields.OrganizationService
|
||||
|
@ -920,7 +919,7 @@ func initAuthorizationService(f platformtesting.AuthorizationFields, t *testing.
|
|||
}
|
||||
|
||||
authorizationBackend := NewMockAuthorizationBackend(t)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
authorizationBackend.AuthorizationService = authService
|
||||
authorizationBackend.UserService = mus
|
||||
authorizationBackend.OrganizationService = tenantService
|
||||
|
@ -937,7 +936,7 @@ func initAuthorizationService(f platformtesting.AuthorizationFields, t *testing.
|
|||
}
|
||||
|
||||
authZ := NewAuthorizationHandler(zaptest.NewLogger(t), authorizationBackend)
|
||||
authN := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0))
|
||||
authN := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
authN.AuthorizationService = authService
|
||||
authN.Handler = authZ
|
||||
authN.UserService = mus
|
||||
|
|
|
@ -7,12 +7,11 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
platcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/jsonweb"
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
@ -13,6 +12,7 @@ import (
|
|||
"github.com/influxdata/influxdb/v2"
|
||||
platformhttp "github.com/influxdata/influxdb/v2/http"
|
||||
"github.com/influxdata/influxdb/v2/jsonweb"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"go.uber.org/zap/zaptest"
|
||||
|
@ -210,7 +210,7 @@ func TestAuthenticationHandler(t *testing.T) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
|
||||
h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0))
|
||||
h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
h.AuthorizationService = tt.fields.AuthorizationService
|
||||
h.SessionService = tt.fields.SessionService
|
||||
h.UserService = &mock.UserService{
|
||||
|
@ -377,7 +377,7 @@ func TestAuthenticationHandler_NoAuthRoutes(t *testing.T) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
|
||||
h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0))
|
||||
h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
h.AuthorizationService = mock.NewAuthorizationService()
|
||||
h.SessionService = mock.NewSessionService()
|
||||
h.Handler = handler
|
||||
|
|
|
@ -9,11 +9,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/NYTimes/gziphandler"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/authorizer"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
func TestBackupMetaService(t *testing.T) {
|
||||
|
@ -117,7 +118,7 @@ func TestRequireOperPermissions(t *testing.T) {
|
|||
r = r.WithContext(ctx)
|
||||
|
||||
h := BackupHandler{
|
||||
HTTPErrorHandler: kithttp.ErrorHandler(0),
|
||||
HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)),
|
||||
}
|
||||
h.requireOperPermissions(next).ServeHTTP(rr, r)
|
||||
rs := rr.Result()
|
||||
|
|
|
@ -425,7 +425,7 @@ func TestService_handleGetCheckQuery(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
checkBackend := NewMockCheckBackend(t)
|
||||
checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
checkBackend.CheckService = tt.fields.CheckService
|
||||
checkBackend.TaskService = &mock.TaskService{
|
||||
FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) {
|
||||
|
@ -567,7 +567,7 @@ func TestService_handleGetCheck(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
checkBackend := NewMockCheckBackend(t)
|
||||
checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
checkBackend.CheckService = tt.fields.CheckService
|
||||
checkBackend.TaskService = &mock.TaskService{
|
||||
FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) {
|
||||
|
@ -838,7 +838,7 @@ func TestService_handleDeleteCheck(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
checkBackend := NewMockCheckBackend(t)
|
||||
checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
checkBackend.CheckService = tt.fields.CheckService
|
||||
checkBackend.TaskService = &mock.TaskService{
|
||||
FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) {
|
||||
|
@ -1005,7 +1005,7 @@ func TestService_handlePatchCheck(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
checkBackend := NewMockCheckBackend(t)
|
||||
checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
checkBackend.CheckService = tt.fields.CheckService
|
||||
checkBackend.TaskService = &mock.TaskService{
|
||||
FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) {
|
||||
|
@ -1200,7 +1200,7 @@ func TestService_handleUpdateCheck(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
checkBackend := NewMockCheckBackend(t)
|
||||
checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
checkBackend.CheckService = tt.fields.CheckService
|
||||
checkBackend.TaskService = &mock.TaskService{
|
||||
FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) {
|
||||
|
|
|
@ -8,13 +8,12 @@ import (
|
|||
http "net/http"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
pcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
"github.com/influxdata/influxdb/v2/predicate"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -10,14 +10,13 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
pcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
"github.com/influxdata/influxdb/v2/models"
|
||||
influxtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
@ -381,7 +380,7 @@ func TestDelete(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
deleteBackend := NewMockDeleteBackend(t)
|
||||
deleteBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
deleteBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
deleteBackend.DeleteService = tt.fields.DeleteService
|
||||
deleteBackend.OrganizationService = tt.fields.OrganizationService
|
||||
deleteBackend.BucketService = tt.fields.BucketService
|
||||
|
|
|
@ -6,11 +6,10 @@ import (
|
|||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -70,7 +70,7 @@ func setup(t *testing.T) (func(auth influxdb.Authorizer) *httptest.Server, func(
|
|||
}
|
||||
|
||||
backend := NewMockDocumentBackend(t)
|
||||
backend.HTTPErrorHandler = http.ErrorHandler(0)
|
||||
backend.HTTPErrorHandler = http.NewErrorHandler(zaptest.NewLogger(t))
|
||||
backend.DocumentService = authorizer.NewDocumentService(svc)
|
||||
serverFn := func(auth influxdb.Authorizer) *httptest.Server {
|
||||
handler := httpmock.NewAuthMiddlewareHandler(NewDocumentHandler(backend), auth)
|
||||
|
|
|
@ -7,11 +7,10 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
pcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
influxtesting "github.com/influxdata/influxdb/v2/testing"
|
||||
|
@ -131,7 +130,7 @@ func TestService_handleGetDocuments(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
documentBackend := NewMockDocumentBackend(t)
|
||||
documentBackend.HTTPErrorHandler = kithttp.ErrorHandler(0)
|
||||
documentBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
documentBackend.DocumentService = tt.fields.DocumentService
|
||||
h := NewDocumentHandler(documentBackend)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
khttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"io"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/influxdb/v2/http"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
func TestCheckError(t *testing.T) {
|
||||
|
@ -23,7 +24,7 @@ func TestCheckError(t *testing.T) {
|
|||
{
|
||||
name: "platform error",
|
||||
write: func(w *httptest.ResponseRecorder) {
|
||||
h := kithttp.ErrorHandler(0)
|
||||
h := kithttp.NewErrorHandler(zaptest.NewLogger(t))
|
||||
err := &errors.Error{
|
||||
Msg: "expected",
|
||||
Code: errors.EInvalid,
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/pprof"
|
||||
|
|
|
@ -8,14 +8,13 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
|
||||
"github.com/influxdata/flux"
|
||||
"github.com/influxdata/flux/csv"
|
||||
"github.com/influxdata/flux/lang"
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
platformhttp "github.com/influxdata/influxdb/v2/http"
|
||||
"github.com/influxdata/influxdb/v2/kit/check"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/tracing"
|
||||
"github.com/influxdata/influxdb/v2/query"
|
||||
"github.com/influxdata/influxdb/v2/query/influxql"
|
||||
|
|
|
@ -8,11 +8,10 @@ import (
|
|||
"net/url"
|
||||
"path"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/pkg/httpc"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -10,11 +10,10 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/httprouter"
|
||||
platform "github.com/influxdata/influxdb/v2"
|
||||
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
|
||||
"github.com/influxdata/influxdb/v2/label"
|
||||
"github.com/influxdata/influxdb/v2/mock"
|
||||
|
@ -114,7 +113,7 @@ func TestService_handleGetLabels(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0))
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
|
||||
r := httptest.NewRequest("GET", "http://any.url", nil)
|
||||
|
||||
|
@ -222,7 +221,7 @@ func TestService_handleGetLabel(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0))
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
|
||||
r := httptest.NewRequest("GET", "http://any.url", nil)
|
||||
|
||||
|
@ -317,7 +316,7 @@ func TestService_handlePostLabel(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0))
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
|
||||
l, err := json.Marshal(tt.args.label)
|
||||
if err != nil {
|
||||
|
@ -408,7 +407,7 @@ func TestService_handleDeleteLabel(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0))
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
|
||||
r := httptest.NewRequest("GET", "http://any.url", nil)
|
||||
|
||||
|
@ -547,7 +546,7 @@ func TestService_handlePatchLabel(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0))
|
||||
h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
|
||||
upd := platform.LabelUpdate{}
|
||||
if len(tt.args.properties) > 0 {
|
||||
|
@ -624,7 +623,7 @@ func initLabelService(f platformtesting.LabelFields, t *testing.T) (platform.Lab
|
|||
}
|
||||
}
|
||||
|
||||
handler := NewLabelHandler(zaptest.NewLogger(t), labelService, kithttp.ErrorHandler(0))
|
||||
handler := NewLabelHandler(zaptest.NewLogger(t), labelService, kithttp.NewErrorHandler(zaptest.NewLogger(t)))
|
||||
server := httptest.NewServer(handler)
|
||||
client := LabelService{
|
||||
Client: mustNewHTTPClient(t, server.URL, ""),
|
||||
|
|
|
@ -3,12 +3,11 @@ package legacy
|
|||
import (
|
||||
http2 "net/http"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/http/metric"
|
||||
"github.com/influxdata/influxdb/v2/influxql"
|
||||
"github.com/influxdata/influxdb/v2/kit/cli"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/influxdata/influxdb/v2/query"
|
||||
"github.com/influxdata/influxdb/v2/storage"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
|
|
@ -3,10 +3,9 @@ package legacy
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
pcontext "github.com/influxdata/influxdb/v2/context"
|
||||
"github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
)
|
||||
|
||||
// getAuthorization extracts authorization information from a context.Context.
|
||||
|
|
|
@ -7,10 +7,9 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
platcontext "github.com/influxdata/influxdb/v2/context"
|
||||
errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue