mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
feat(campaign): record the label source in the manifest
A finished sweep should say which cell it ran without anyone having to remember the invocation. Claude-Session: https://claude.ai/code/session_01A5KmftdEJ49A9z5mF5ESrX
This commit is contained in:
1 parent
ff2de344e9
commit
ebed84afc3
2 files changed
+26
No files matched your search
@@ -21,6 +21,7 @@ const (
|
|||||||
type manifest struct {
|
type manifest struct {
|
||||||
Arm string `json:"arm"`
|
Arm string `json:"arm"`
|
||||||
Generator string `json:"generator"`
|
Generator string `json:"generator"`
|
||||||
|
LabelSource string `json:"label_source"`
|
||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
SpecPath string `json:"spec_path"`
|
SpecPath string `json:"spec_path"`
|
||||||
BundleID string `json:"bundle_id"`
|
BundleID string `json:"bundle_id"`
|
||||||
@@ -44,6 +45,7 @@ func buildManifest(configuration config, host, binaryPath, version string, start
|
|||||||
return manifest{
|
return manifest{
|
||||||
Arm: configuration.arm,
|
Arm: configuration.arm,
|
||||||
Generator: configuration.generator,
|
Generator: configuration.generator,
|
||||||
|
LabelSource: configuration.labelSource,
|
||||||
Platform: configuration.platform,
|
Platform: configuration.platform,
|
||||||
SpecPath: configuration.specPath,
|
SpecPath: configuration.specPath,
|
||||||
BundleID: configuration.bundleID,
|
BundleID: configuration.bundleID,
|
||||||
|
|||||||
@@ -41,6 +41,30 @@ func TestBuildManifest_RecordsIntendedRunsAndTemplate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWriteManifest_RecordsTheLabelSourceCell(t *testing.T) {
|
||||||
|
configuration, err := parseArguments(append(baseArguments(), "--label-source", "resource-id"), io.Discard)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
directory := t.TempDir()
|
||||||
|
if err := writeManifest(directory, buildManifest(configuration, "host", "sanderling", "dev", time.Now())); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
body, err := os.ReadFile(filepath.Join(directory, manifestFileName))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var decoded struct {
|
||||||
|
LabelSource string `json:"label_source"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(body, &decoded); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if decoded.LabelSource != "resource-id" {
|
||||||
|
t.Errorf("label_source: got %q, want resource-id", decoded.LabelSource)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuildManifest_EmptyDeviceListSerializesAsArray(t *testing.T) {
|
func TestBuildManifest_EmptyDeviceListSerializesAsArray(t *testing.T) {
|
||||||
configuration, err := parseArguments(baseArguments(), io.Discard)
|
configuration, err := parseArguments(baseArguments(), io.Discard)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user