Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-db/go/conn_test.go
2497 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package db
6
7
import (
8
"github.com/stretchr/testify/require"
9
"testing"
10
)
11
12
func TestConnectionParamsFromEnv(t *testing.T) {
13
t.Setenv("DB_USERNAME", "username")
14
t.Setenv("DB_PASSWORD", "pass")
15
t.Setenv("DB_HOST", "dbhost")
16
t.Setenv("DB_PORT", "dbport")
17
t.Setenv("DB_CA_CERT", "cacert")
18
19
require.Equal(t, ConnectionParams{
20
User: "username",
21
Password: "pass",
22
Host: "dbhost:dbport",
23
Database: "gitpod",
24
CaCert: "cacert",
25
}, ConnectionParamsFromEnv())
26
}
27
28