MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / TestPlugin

Function TestPlugin

plugins/destination/file/client/client_test.go:108–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestPlugin(t *testing.T) {
109 syncAfterWrite = true // turn on sync after write and wait before read
110 for _, ts := range testSpecs(t) {
111 ts := ts
112 t.Run(ts.testName, func(t *testing.T) {
113 t.Parallel()
114 if ts.Spec.Format == filetypes.FormatTypeParquet || ts.Spec.Compression != filetypes.CompressionTypeNone {
115 testPluginCustom(t, &ts.Spec)
116 } else {
117 testPlugin(t, &ts.Spec)
118 }
119
120 fi, err := os.Stat(ts.baseDir)
121 assert.NoError(t, err)
122 assert.Truef(t, fi.IsDir(), "basedir %s is not a directory", ts.baseDir)
123
124 fileCount := 0
125 assert.NoError(t, filepath.WalkDir(ts.baseDir, func(path string, d os.DirEntry, err error) error {
126 assert.NoError(t, err)
127 if err != nil {
128 return err
129 }
130 t.Log("walking path", path)
131 if !d.IsDir() {
132 fileCount++
133 }
134 if !assert.NotContainsf(t, path, "{", "path %s still contains template", path) {
135 return errors.New("test failed")
136 }
137 return nil
138 }))
139
140 assert.NotZero(t, fileCount, "no files written to %s", ts.baseDir)
141 })
142 }
143}
144
145func testPlugin(t *testing.T, s *spec.Spec) {
146 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

testSpecsFunction · 0.85
RunMethod · 0.80
testPluginCustomFunction · 0.70
testPluginFunction · 0.70
LogMethod · 0.45

Tested by

no test coverage detected