Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Bug Fixes:

- fix(compute): add Python starter kit to the static config ([#1877](https://github.com/fastly/cli/pull/1877))

### Enhancements:

- feat(audit-log): add event-mapping command group ([#1875](https://github.com/fastly/cli/pull/1875))
Expand Down
40 changes: 40 additions & 0 deletions pkg/commands/compute/language_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package compute_test

import (
"testing"

toml "github.com/pelletier/go-toml"

"github.com/fastly/cli/pkg/commands/compute"
"github.com/fastly/cli/pkg/config"
)

// TestStaticConfigStarterKits validates that every language the CLI offers at
// the `compute init` prompt has at least one starter kit in the static config
// embedded into the binary.
//
// The starter kits are injected into the static config at build time by
// ./scripts/config.sh, which holds its own hardcoded list of starter kit
// repositories. Adding a language without also updating that list leaves users
// of the new language unable to init a project (see CDTOOL-1707), and this test
// is here to catch that drift.
//
// NOTE: The static config is generated, not committed, so run `make config`
// before running this test locally.
func TestStaticConfigStarterKits(t *testing.T) {
var f config.File
if err := toml.Unmarshal(config.Static, &f); err != nil {
t.Fatalf("failed to unmarshal the static config: %s", err)
}

for _, language := range compute.NewLanguages(f.StarterKits) {
// The 'other' language is for users bringing their own Wasm binary and so
// has no starter kits by design.
if language.Name == "other" {
continue
}
if len(language.StarterKits) == 0 {
t.Errorf("no starter kits found in the static config for language %q: add its starter kit repositories to the 'kits' list in ./scripts/config.sh", language.Name)
}
}
}
1 change: 1 addition & 0 deletions scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kits=(
compute-starter-kit-typescript
compute-starter-kit-cpp-default
compute-starter-kit-cpp-empty
compute-starter-kit-python-default
)

function parse() {
Expand Down
Loading