github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ccl/importccl/read_import_base_test.go (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Licensed as a CockroachDB Enterprise file under the Cockroach Community 4 // License (the "License"); you may not use this file except in compliance with 5 // the License. You may obtain a copy of the License at 6 // 7 // https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt 8 9 package importccl 10 11 import ( 12 "testing" 13 14 "github.com/cockroachdb/cockroach/pkg/util/leaktest" 15 ) 16 17 func TestRejectedFilename(t *testing.T) { 18 defer leaktest.AfterTest(t)() 19 tests := []struct { 20 name string 21 fname string 22 rejected string 23 }{ 24 { 25 name: "http", 26 fname: "http://127.0.0.1", 27 rejected: "http://127.0.0.1/.rejected", 28 }, 29 { 30 name: "nodelocal", 31 fname: "nodelocal://0/file.csv", 32 rejected: "nodelocal://0/file.csv.rejected", 33 }, 34 } 35 for _, tc := range tests { 36 rej, err := rejectedFilename(tc.fname) 37 if err != nil { 38 t.Fatal(err) 39 } 40 if tc.rejected != rej { 41 t.Errorf("expected:\n%v\ngot:\n%v\n", tc.rejected, rej) 42 } 43 } 44 }