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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Enhancements:
- feat(rust): Allow testing with prerelease Rust versions ([#1604](https://github.com/fastly/cli/pull/1604))
- feat(compute/hashfiles): remove hashsum subcommand ([#1608](https://github.com/fastly/cli/pull/1608))

### Bug fixes:

Expand Down
2 changes: 1 addition & 1 deletion pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ func determineProfile(manifestValue, flagValue string, profiles config.Profiles)
// collects data related to a Wasm binary.
func commandCollectsData(command string) bool {
switch command {
case "compute build", "compute hashsum", "compute hash-files", "compute publish", "compute serve":
case "compute build", "compute hash-files", "compute publish", "compute serve":
return true
}
return false
Expand Down
2 changes: 0 additions & 2 deletions pkg/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func Define( // nolint:revive // function-length
computeBuild := compute.NewBuildCommand(computeCmdRoot.CmdClause, data)
computeDeploy := compute.NewDeployCommand(computeCmdRoot.CmdClause, data)
computeHashFiles := compute.NewHashFilesCommand(computeCmdRoot.CmdClause, data, computeBuild)
computeHashsum := compute.NewHashsumCommand(computeCmdRoot.CmdClause, data, computeBuild)
computeInit := compute.NewInitCommand(computeCmdRoot.CmdClause, data)
computeMetadata := compute.NewMetadataCommand(computeCmdRoot.CmdClause, data)
computePack := compute.NewPackCommand(computeCmdRoot.CmdClause, data)
Expand Down Expand Up @@ -742,7 +741,6 @@ func Define( // nolint:revive // function-length
computeBuild,
computeDeploy,
computeHashFiles,
computeHashsum,
computeInit,
computeMetadata,
computePack,
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/compute/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type BuildCommand struct {
argparser.Base

// NOTE: Composite commands require these build flags to be public.
// e.g. serve, publish, hashsum, hash-files
// e.g. serve, publish, hash-files
// This is so they can set values appropriately before calling Build.Exec().
Flags Flags
MetadataDisable bool
Expand Down Expand Up @@ -874,7 +874,7 @@ func bytesToMB(bytes uint64) uint64 {
}

// bucketMB determines a consistent bucket size for heap allocation.
// NOTE: This is to avoid building a package with a fluctuating hashsum.
// NOTE: This is to avoid building a package with a fluctuating hash.
// e.g. `fastly compute hash-files` should be consistent unless memory increase is significant.
func bucketMB(mb uint64) string {
switch {
Expand Down
59 changes: 4 additions & 55 deletions pkg/commands/compute/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,60 +129,9 @@ func TestFlagDivergenceServe(t *testing.T) {
}
}

// TestFlagDivergenceHashSum validates that the manually curated list of flags
// within the `compute hashsum` command doesn't fall out of sync with the
// `compute build` command as `compute hashsum` delegates to build.
func TestFlagDivergenceHashSum(t *testing.T) {
var cfg global.Data
acmd := kingpin.New("foo", "bar")

rcmd := compute.NewRootCommand(acmd, &cfg)
bcmd := compute.NewBuildCommand(rcmd.CmdClause, &cfg)
hcmd := compute.NewHashsumCommand(rcmd.CmdClause, &cfg, bcmd)

buildFlags := getFlags(bcmd.CmdClause)
hashsumFlags := getFlags(hcmd.CmdClause)

var (
expect = make(map[string]int)
have = make(map[string]int)
)

// Some flags on `compute build` are unique to it.
// NOTE: There are no flags to ignore but I'm keeping the logic for future.
ignoreBuildFlags := []string{}

iter := buildFlags.MapRange()
for iter.Next() {
flag := iter.Key().String()
if !ignoreFlag(ignoreBuildFlags, flag) {
expect[flag] = 1
}
}

// Some flags on `compute hashsum` are unique to it.
// We only want to be sure hashsum contains all build flags.
ignoreHashsumFlags := []string{
"package",
"skip-build",
}

iter = hashsumFlags.MapRange()
for iter.Next() {
flag := iter.Key().String()
if !ignoreFlag(ignoreHashsumFlags, flag) {
have[flag] = 1
}
}

if !reflect.DeepEqual(expect, have) {
t.Fatalf("the flags between build and hashsum don't match\n\nexpect: %+v\nhave: %+v\n\n", expect, have)
}
}

// TestFlagDivergenceHashFiles validates that the manually curated list of flags
// within the `compute hashsum` command doesn't fall out of sync with the
// `compute build` command as `compute hashsum` delegates to build.
// within the `compute hash-files` command doesn't fall out of sync with the
// `compute build` command as `compute hash-files` delegates to build.
func TestFlagDivergenceHashFiles(t *testing.T) {
var cfg global.Data
acmd := kingpin.New("foo", "bar")
Expand Down Expand Up @@ -211,8 +160,8 @@ func TestFlagDivergenceHashFiles(t *testing.T) {
}
}

// Some flags on `compute hashsum` are unique to it.
// We only want to be sure hashsum contains all build flags.
// Some flags on `compute hash-files` are unique to it.
// We only want to be sure hash-files contains all build flags.
ignoreHashfilesFlags := []string{
"package",
"skip-build",
Expand Down
204 changes: 0 additions & 204 deletions pkg/commands/compute/hashsum.go

This file was deleted.