Files
teleport/lib/backend/backend_test.go
T
Edoardo Spadolini 236b1b2f3c Remove the SQL backend (#17057)
* Revert "Azure AD authentication for the Postgres backend (#15757)"

This reverts commit 33c6d82dc3.

* Revert "SQL Backend (#11048)"

This reverts commit 06fef2abf1.

* Remove Postgres backend from the docs

* Remove the Postgres backend from the testplan
2022-10-07 10:40:44 +02:00

58 lines
1.3 KiB
Go

/*
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package backend
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParams(t *testing.T) {
const (
expectedPath = "/usr/bin"
expectedCount = 200
)
p := Params{
"path": expectedPath,
"enabled": true,
"count": expectedCount,
}
path := p.GetString("path")
if path != expectedPath {
t.Errorf("expected 'path' to be '%v', got '%v'", expectedPath, path)
}
}
func TestRangeEnd(t *testing.T) {
for _, test := range []struct {
key, expected string
}{
{"abc", "abd"},
{"/foo/bar", "/foo/bas"},
{"/xyz", "/xy{"},
{"\xFF", "\x00"},
{"\xFF\xFF\xFF", "\x00"},
} {
t.Run(test.key, func(t *testing.T) {
end := RangeEnd([]byte(test.key))
require.Equal(t, test.expected, string(end))
})
}
}