fix: more expressive errors (#22448)

* fix: more expressive errors

Closes #22446

* fix: server only logging for untyped errors

* chore: fix formatting
pull/22465/head
Sam Arnold 2021-09-13 15:12:35 -04:00 committed by GitHub
parent 3e275a123d
commit 5015297d40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
399 changed files with 587 additions and 872 deletions

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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 {

View File

@ -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"

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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

View File

@ -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"
)

View File

@ -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"

View File

@ -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"
)

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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)

View File

@ -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"
)

View File

@ -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 {

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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"
)

View File

@ -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.

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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) {

View File

@ -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)

View File

@ -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"
)

View File

@ -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 {

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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"

View File

@ -6,7 +6,6 @@ import (
"math/rand"
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
bolt "go.etcd.io/bbolt"
"go.uber.org/zap"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"

View File

@ -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"

View File

@ -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()...)

View File

@ -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"
)

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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) {

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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

View File

@ -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"

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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

View File

@ -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

View File

@ -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"
)

View File

@ -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

View File

@ -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"
)

View File

@ -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 (

View File

@ -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),
}

View File

@ -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"
)

View File

@ -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

View File

@ -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"
)

View File

@ -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

View File

@ -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"
)

View File

@ -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()

View File

@ -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) {

View File

@ -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"
)

View File

@ -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

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -12,7 +12,6 @@ import (
"strings"
"github.com/influxdata/influxdb/v2/kit/platform/errors"
khttp "github.com/influxdata/influxdb/v2/kit/transport/http"
)

View File

@ -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,

View File

@ -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"

View File

@ -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"

View File

@ -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"
)

View File

@ -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, ""),

View File

@ -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"

View File

@ -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.

View File

@ -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