|
package config |
|
|
|
import ( |
|
"os" |
|
|
|
. "github.com/onsi/ginkgo/v2" |
|
. "github.com/onsi/gomega" |
|
) |
|
|
|
var _ = Describe("Test cases for config related functions", func() { |
|
|
|
var ( |
|
configFile string |
|
) |
|
|
|
Context("Test Read configuration functions", func() { |
|
configFile = os.Getenv("CONFIG_FILE") |
|
It("Test readConfigFile", func() { |
|
config, err := readMultipleBackendConfigsFromFile(configFile) |
|
Expect(err).To(BeNil()) |
|
Expect(config).ToNot(BeNil()) |
|
|
|
Expect(config[0].Name).To(Equal("list1")) |
|
Expect(config[1].Name).To(Equal("list2")) |
|
}) |
|
|
|
It("Test LoadConfigs", func() { |
|
|
|
bcl := NewBackendConfigLoader(os.Getenv("MODELS_PATH")) |
|
err := bcl.LoadBackendConfigsFromPath(os.Getenv("MODELS_PATH")) |
|
|
|
Expect(err).To(BeNil()) |
|
configs := bcl.GetAllBackendConfigs() |
|
loadedModelNames := []string{} |
|
for _, v := range configs { |
|
loadedModelNames = append(loadedModelNames, v.Name) |
|
} |
|
Expect(configs).ToNot(BeNil()) |
|
|
|
Expect(loadedModelNames).To(ContainElements("code-search-ada-code-001")) |
|
|
|
|
|
Expect(loadedModelNames).To(ContainElements("text-embedding-ada-002")) |
|
|
|
|
|
Expect(loadedModelNames).To(ContainElements("rwkv_test")) |
|
|
|
|
|
Expect(loadedModelNames).To(ContainElements("whisper-1")) |
|
}) |
|
}) |
|
}) |
|
|