(t *testing.T)
| 28 | return &pb.Session{DbConnStr: database.GetTestingMySQLURL()} |
| 29 | } |
| 30 | func TestTrainCodegen(t *testing.T) { |
| 31 | driver := os.Getenv("SQLFLOW_TEST_DB") |
| 32 | |
| 33 | a := assert.New(t) |
| 34 | tir := ir.MockTrainStmt(false) |
| 35 | _, err := Train(tir, mockSession()) |
| 36 | a.NoError(err) |
| 37 | |
| 38 | pir := ir.MockPredStmt(tir) |
| 39 | |
| 40 | sess := &pb.Session{ |
| 41 | Token: "", |
| 42 | DbConnStr: "", |
| 43 | ExitOnSubmit: false, |
| 44 | UserId: "", |
| 45 | } |
| 46 | if driver == "hive" { |
| 47 | sess.DbConnStr = database.GetTestingHiveURL() |
| 48 | } |
| 49 | code, err := Pred(pir, sess) |
| 50 | a.NoError(err) |
| 51 | |
| 52 | if driver == "hive" { |
| 53 | r, _ := regexp.Compile(`hive_location=(.*)`) |
| 54 | a.Contains(r.FindStringSubmatch(code)[1], "/sqlflow") |
| 55 | r, _ = regexp.Compile(`hdfs_namenode_addr=(.*)&`) |
| 56 | a.Equal(r.FindStringSubmatch(code)[1], "") |
| 57 | } else { |
| 58 | r, _ := regexp.Compile(`hive_location=(.*)`) |
| 59 | a.Equal(0, len(r.FindStringSubmatch(code))) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestTrainWithModelRepoImage(t *testing.T) { |
| 64 | a := assert.New(t) |
nothing calls this directly
no test coverage detected