Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
130 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include('../Tiltfile') | ||
|
||
watch_file('small.txt') | ||
watch_file('large.txt') | ||
k8s_yaml(local('kubectl create configmap -n tilt-integration large-configmap --from-file=key.txt=./large.txt --dry-run=client -o=yaml', quiet=True)) | ||
k8s_yaml(local('kubectl create configmap -n tilt-integration small-configmap --from-file=key.txt=./small.txt --dry-run=client -o=yaml', quiet=True)) |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
hello world |
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,45 @@ | ||
//+build integration | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestConfigMap(t *testing.T) { | ||
f := newK8sFixture(t, "configmap") | ||
defer f.TearDown() | ||
|
||
f.TiltWatch() | ||
|
||
ctx, cancel := context.WithTimeout(f.ctx, time.Minute) | ||
defer cancel() | ||
|
||
f.WaitUntil(ctx, "Waiting for small configmap to show up", func() (string, error) { | ||
out, _ := f.runCommand("kubectl", "get", "configmap", "small-configmap", namespaceFlag, "-o=go-template", "--template='{{.data}}'") | ||
return out.String(), nil | ||
}, "hello world") | ||
|
||
firstCreationTime, err := f.runCommand("kubectl", "get", "configmap", "small-configmap", namespaceFlag, "-o=go-template", "--template='{{.metadata.creationTimestamp}}'") | ||
require.NoError(t, err) | ||
require.NotEqual(t, "", firstCreationTime.String()) | ||
|
||
f.ReplaceContents("small.txt", "hello world", "goodbye world") | ||
|
||
f.WaitUntil(ctx, "Waiting for small configmap to get replaced", func() (string, error) { | ||
out, _ := f.runCommand("kubectl", "get", "configmap", "small-configmap", namespaceFlag, "-o=go-template", "--template='{{.data}}'") | ||
return out.String(), nil | ||
}, "goodbye world") | ||
|
||
secondCreationTime, err := f.runCommand("kubectl", "get", "configmap", "small-configmap", namespaceFlag, "-o=go-template", "--template='{{.metadata.creationTimestamp}}'") | ||
require.NoError(t, err) | ||
require.NotEqual(t, "", secondCreationTime.String()) | ||
|
||
// Make sure we applied the configmap instead of recreating it | ||
assert.Equal(t, firstCreationTime, secondCreationTime) | ||
} |
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