mirror of https://github.com/databricks/cli.git
address comments
This commit is contained in:
parent
2a0dbdec3e
commit
a2a3ae7154
|
@ -23,6 +23,7 @@ func TestBuiltInReader(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, name := range exists {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
r := &builtinReader{name: name}
|
||||
fs, err := r.FS(context.Background())
|
||||
assert.NoError(t, err)
|
||||
|
@ -36,14 +37,17 @@ func TestBuiltInReader(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
assert.Contains(t, string(b), "welcome_message")
|
||||
assert.NoError(t, fd.Close())
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("doesnotexist", func(t *testing.T) {
|
||||
r := &builtinReader{name: "doesnotexist"}
|
||||
_, err := r.FS(context.Background())
|
||||
assert.EqualError(t, err, "builtin template doesnotexist not found")
|
||||
|
||||
// Close should not error.
|
||||
assert.NoError(t, r.Close())
|
||||
})
|
||||
}
|
||||
|
||||
func TestGitUrlReader(t *testing.T) {
|
||||
|
@ -56,7 +60,7 @@ func TestGitUrlReader(t *testing.T) {
|
|||
cloneFunc := func(ctx context.Context, url, reference, targetPath string) error {
|
||||
numCalls++
|
||||
args = []string{url, reference, targetPath}
|
||||
err := os.MkdirAll(filepath.Join(targetPath, "a/b/c"), 0o755)
|
||||
err := os.MkdirAll(filepath.Join(targetPath, "a", "b", "c"), 0o755)
|
||||
require.NoError(t, err)
|
||||
testutil.WriteFile(t, filepath.Join(targetPath, "a", "b", "c", "somefile"), "somecontent")
|
||||
return nil
|
||||
|
|
|
@ -42,6 +42,7 @@ func TestTemplateResolverForDefaultTemplates(t *testing.T) {
|
|||
"default-sql",
|
||||
"dbt-sql",
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
r := Resolver{
|
||||
TemplatePathOrUrl: name,
|
||||
}
|
||||
|
@ -51,8 +52,10 @@ func TestTemplateResolverForDefaultTemplates(t *testing.T) {
|
|||
|
||||
assert.Equal(t, &builtinReader{name: name}, tmpl.Reader)
|
||||
assert.IsType(t, &writerWithFullTelemetry{}, tmpl.Writer)
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("mlops-stacks", func(t *testing.T) {
|
||||
r := Resolver{
|
||||
TemplatePathOrUrl: "mlops-stacks",
|
||||
ConfigFile: "/config/file",
|
||||
|
@ -64,6 +67,7 @@ func TestTemplateResolverForDefaultTemplates(t *testing.T) {
|
|||
// Assert reader and writer configuration
|
||||
assert.Equal(t, "https://github.com/databricks/mlops-stacks", tmpl.Reader.(*gitReader).gitUrl)
|
||||
assert.Equal(t, "/config/file", tmpl.Writer.(*writerWithFullTelemetry).configPath)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTemplateResolverForCustomUrl(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue