feat: show better error on invalid template upload (#3847)

* feat: show better error on invalid template upload

* Fix tests
This commit is contained in:
Ammar Bandukwala
2022-09-02 22:48:40 +00:00
committed by GitHub
parent ac50070713
commit a09ffd6c0d
4 changed files with 61 additions and 10 deletions
+4
View File
@@ -5,6 +5,7 @@ import (
"bytes"
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -52,6 +53,9 @@ func SetupConfig(t *testing.T, client *codersdk.Client, root config.Root) {
// new temporary testing directory.
func CreateTemplateVersionSource(t *testing.T, responses *echo.Responses) string {
directory := t.TempDir()
f, err := ioutil.TempFile(directory, "*.tf")
require.NoError(t, err)
f.Close()
data, err := echo.Tar(responses)
require.NoError(t, err)
extractTar(t, data, directory)