-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patches a regression with our Kong addon Postgres that came around due to a typo in helm values. Adds integration tests for it so we're less likely to run into that again.
- Loading branch information
Showing
3 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//+build integration_tests | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
kongaddon "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/kong" | ||
metallbaddon "github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/metallb" | ||
environment "github.com/kong/kubernetes-testing-framework/pkg/environments" | ||
) | ||
|
||
func TestKongWithPostgresDBMode(t *testing.T) { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) | ||
defer cancel() | ||
|
||
t.Log("configuring the testing environment") | ||
metallb := metallbaddon.New() | ||
kong := kongaddon.NewBuilder().WithPostgreSQL().Build() | ||
builder := environment.NewBuilder().WithAddons(kong, metallb) | ||
|
||
t.Log("building the testing environment and Kubernetes cluster") | ||
env, err := builder.Build(ctx) | ||
require.NoError(t, err) | ||
|
||
t.Logf("setting up the environment cleanup for environment %s and cluster %s", env.Name(), env.Cluster().Name()) | ||
defer func() { | ||
t.Logf("cleaning up environment %s and cluster %s", env.Name(), env.Cluster().Name()) | ||
require.NoError(t, env.Cleanup(ctx)) | ||
}() | ||
|
||
t.Log("waiting for environment to be ready") | ||
require.NoError(t, <-env.WaitForReady(ctx)) | ||
|
||
t.Logf("verifying that the kong proxy admin service %s gets provisioned an IP address by metallb", kongaddon.DefaultAdminServiceName) | ||
adminURL, err := kong.ProxyAdminURL(ctx, env.Cluster()) | ||
require.NoError(t, err) | ||
require.NotNil(t, adminURL) | ||
|
||
t.Logf("found url %s for proxy admin, now verifying it is routable", adminURL) | ||
httpc := http.Client{Timeout: time.Second * 3} | ||
require.Eventually(t, func() bool { | ||
resp, err := httpc.Get(adminURL.String()) | ||
if err != nil { | ||
return false | ||
} | ||
defer resp.Body.Close() | ||
return resp.StatusCode == http.StatusOK | ||
}, time.Minute*1, time.Second*1) | ||
} |