Skip to content

Commit

Permalink
Refactor data capture -- single patch
Browse files Browse the repository at this point in the history
  • Loading branch information
dgottlieb authored and nicksanford committed Jul 10, 2024
1 parent 31be181 commit 753b65f
Show file tree
Hide file tree
Showing 14 changed files with 575 additions and 495 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ coverage.xml
profile*.pdf
code-coverage-results.md
metadata
data.ndjson

*~
*#
Expand All @@ -53,7 +54,6 @@ metadata
# act
.secrets

/data/
out/
.idea/*
bin/
Expand Down
8 changes: 7 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"go.viam.com/rdk/logging"
"go.viam.com/rdk/referenceframe"
"go.viam.com/rdk/resource"
"go.viam.com/rdk/services/datamanager"
"go.viam.com/rdk/services/shell"
"go.viam.com/rdk/spatialmath"
rutils "go.viam.com/rdk/utils"
Expand Down Expand Up @@ -69,6 +70,8 @@ func TestConfigRobot(t *testing.T) {
test.That(t, newBc, test.ShouldResemble, bc)
}

// TestConfig3 depends on the `datamanager` package *not* being loaded. Its `init` function
// registers an associated API that alters `AssociatedResourceConfigs` results.
func TestConfig3(t *testing.T) {
logger := logging.NewTestLogger(t)

Expand Down Expand Up @@ -107,13 +110,15 @@ func TestConfig3(t *testing.T) {
MaxPowerPct: 0.5,
TicksPerRotation: 10000,
})

test.That(t, cfg.Components[2].AssociatedResourceConfigs, test.ShouldHaveLength, 1)
test.That(t, cfg.Components[2].AssociatedResourceConfigs[0], test.ShouldResemble, resource.AssociatedResourceConfig{
API: resource.APINamespaceRDK.WithServiceType("data_manager"),
Attributes: rutils.AttributeMap{
"hi": 1.1,
"friend": 2.2,
},
ConvertedAttributes: &datamanager.AssociatedConfig{},
})

test.That(t, cfg.Components[3].ConvertedAttributes, test.ShouldResemble, &incremental.Config{
Expand All @@ -135,7 +140,8 @@ func TestConfig3(t *testing.T) {
"hi": 3.3,
"friend": 4.4,
},
RemoteName: "rem1",
ConvertedAttributes: &datamanager.AssociatedConfig{},
RemoteName: "rem1",
})
test.That(t, cfg.Remotes[0].AssociatedResourceConfigs[1], test.ShouldResemble, resource.AssociatedResourceConfig{
API: resource.APINamespaceRDK.WithServiceType("some_type"),
Expand Down
Loading

0 comments on commit 753b65f

Please sign in to comment.