Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sammcj committed Feb 6, 2025
1 parent a27491e commit cf65740
Showing 1 changed file with 45 additions and 39 deletions.
84 changes: 45 additions & 39 deletions operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,51 @@ func TestRunModel(t *testing.T) {
// Determine if we're running in CI
inCI := os.Getenv("CI") != "" || os.Getenv("GITHUB_ACTIONS") != ""

tests := []struct {
name string
model string
cfg *config.Config
expectDocker bool
expectError bool
}{
{
name: "Run with Docker",
model: "test-model",
cfg: &config.Config{DockerContainer: "test-container"},
expectDocker: true,
expectError: inCI, // Expect error in CI since docker won't be available
},
{
name: "Run without Docker",
model: "test-model",
cfg: &config.Config{DockerContainer: ""},
expectDocker: false,
expectError: inCI, // Expect error in CI since ollama won't be available
},
{
name: "Run with Docker set to false",
model: "test-model",
cfg: &config.Config{DockerContainer: "false"},
expectDocker: false,
expectError: inCI, // Expect error in CI since ollama won't be available
},
}
// if we're running in CI, simply skip these tests
if inCI {
t.Skip("Skipping operations tests in CI")
} else {

tests := []struct {
name string
model string
cfg *config.Config
expectDocker bool
expectError bool
}{
{
name: "Run with Docker",
model: "test-model",
cfg: &config.Config{DockerContainer: "test-container"},
expectDocker: true,
expectError: inCI, // Expect error in CI since docker won't be available
},
{
name: "Run without Docker",
model: "test-model",
cfg: &config.Config{DockerContainer: ""},
expectDocker: false,
expectError: inCI, // Expect error in CI since ollama won't be available
},
{
name: "Run with Docker set to false",
model: "test-model",
cfg: &config.Config{DockerContainer: "false"},
expectDocker: false,
expectError: inCI, // Expect error in CI since ollama won't be available
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := runModel(tt.model, tt.cfg)
if (cmd == nil) != tt.expectError {
t.Errorf("runModel() error = %v, expectError %v", cmd == nil, tt.expectError)
t.Logf("cmd: %v", cmd)
return
}
// Further assertions can be added based on how you want to validate the `tea.Cmd` returned
})
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := runModel(tt.model, tt.cfg)
if (cmd == nil) != tt.expectError {
t.Errorf("runModel() error = %v, expectError %v", cmd == nil, tt.expectError)
t.Logf("cmd: %v", cmd)
return
}
// Further assertions can be added based on how you want to validate the `tea.Cmd` returned
})
}
}
}

0 comments on commit cf65740

Please sign in to comment.