Fix schemagen and test generated code

This commit is contained in:
Dmitry Kropachev
2024-06-26 13:32:47 -04:00
committed by Sylwia Szunejko
parent fcd76082db
commit 653faf1e03
9 changed files with 190 additions and 11 deletions

View File

@@ -28,9 +28,9 @@ func TestSchemagen(t *testing.T) {
}, ",")
*flagIgnoreIndexes = true
b := runSchemagen(t, "foobar")
b := runSchemagen(t, "schemagentest")
const goldenFile = "testdata/models.go.txt"
const goldenFile = "testdata/models.go"
if *flagUpdate {
if err := ioutil.WriteFile(goldenFile, b, os.ModePerm); err != nil {
t.Fatal(err)
@@ -132,6 +132,7 @@ func createTestSchema(t *testing.T) {
title text,
album text,
artist text,
duration duration,
tags set<text>,
data blob)`)
if err != nil {
@@ -193,7 +194,9 @@ func runSchemagen(t *testing.T, pkgname string) []byte {
t.Fatal(err)
}
keyspace := "schemagen"
cl := "127.0.1.1"
flagCluster = &cl
flagKeyspace = &keyspace
flagPkgname = &pkgname
flagOutput = &dir