Skip to content

Commit

Permalink
RSDK-2029 - Remove/replace rdk integration tests with local tests (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkufieta authored Apr 24, 2023
1 parent b65b469 commit 98bb1fd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,10 @@ jobs:
run: |
sudo cp viam-orb-slam3/viam-orb-slam3/bin/orb_grpc_server /usr/local/bin/orb_grpc_server
- name: Check out code in rdk directory
if: matrix.platform == 'linux/amd64'
uses: actions/checkout@v3
with:
repository: viamrobotics/rdk
path: rdk

- name: Run rdk slam integration tests
- name: Run viam-orb-slam3 integration tests
if: matrix.platform == 'linux/amd64'
run: |
sudo -u testbot bash -lc 'cd rdk/services/slam/builtin && sudo go test -v -run TestOrbslamIntegration'
sudo -u testbot bash -lc 'cd viam-orb-slam3 && sudo go test -v -race -run TestOrbslamIntegration'
- name: Build appimage
run: sudo -u testbot bash -lc 'cd viam-orb-slam3 && make BUILD_CHANNEL="latest" appimage'
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,6 @@ jobs:
run: |
sudo cp viam-orb-slam3/viam-orb-slam3/bin/orb_grpc_server /usr/local/bin/orb_grpc_server
- name: Check out code in rdk directory
if: matrix.platform == 'linux/amd64'
uses: actions/checkout@v3
# Pulls main/HEAD from rdk to ensure no accidental regressions
with:
repository: viamrobotics/rdk
path: rdk

- name: Run rdk orbslam integration tests
if: matrix.platform == 'linux/amd64'
run: |
sudo -u testbot bash -lc 'cd rdk/services/slam/builtin && sudo go test -v -race -run TestOrbslamIntegration'
- name: Run viam-orb-slam3 integration tests
if: matrix.platform == 'linux/amd64'
run: |
Expand Down
9 changes: 5 additions & 4 deletions orbslam_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import (
"github.com/edaniels/golog"
"github.com/pkg/errors"
"go.viam.com/rdk/rimage/transform"
"go.viam.com/rdk/services/slam/builtin"
slamConfig "go.viam.com/slam/config"
"go.viam.com/slam/dataprocess"
slamTesthelper "go.viam.com/slam/testhelper"
"go.viam.com/test"
"go.viam.com/utils"
"gopkg.in/yaml.v2"

viamorbslam3 "github.com/viamrobotics/viam-orb-slam3"
)

const yamlFilePrefixBytes = "%YAML:1.0\n"
Expand Down Expand Up @@ -134,7 +135,7 @@ func TestOrbslamYAMLNew(t *testing.T) {
test.That(t, yamlDataAll[:len(yamlFilePrefixBytes)], test.ShouldResemble, []byte(yamlFilePrefixBytes))

yamlData := bytes.Replace(yamlDataAll, []byte(yamlFilePrefixBytes), []byte(""), 1)
orbslam := builtin.ORBsettings{}
orbslam := viamorbslam3.ORBsettings{}
err = yaml.Unmarshal(yamlData, &orbslam)
test.That(t, err, test.ShouldBeNil)
test.That(t, orbslam.Width, test.ShouldEqual, 1280)
Expand Down Expand Up @@ -170,7 +171,7 @@ func TestOrbslamYAMLNew(t *testing.T) {
yamlDataAll, err := os.ReadFile(yamlFilePathGood)
test.That(t, err, test.ShouldBeNil)
yamlData := bytes.Replace(yamlDataAll, []byte(yamlFilePrefixBytes), []byte(""), 1)
orbslam := builtin.ORBsettings{}
orbslam := viamorbslam3.ORBsettings{}
err = yaml.Unmarshal(yamlData, &orbslam)
test.That(t, err, test.ShouldBeNil)
test.That(t, orbslam.LoadMapLoc, test.ShouldEqual, "\""+fakeMap+"\"")
Expand All @@ -197,7 +198,7 @@ func TestOrbslamYAMLNew(t *testing.T) {
test.That(t, yamlDataAll[:len(yamlFilePrefixBytes)], test.ShouldResemble, []byte(yamlFilePrefixBytes))

yamlData := bytes.Replace(yamlDataAll, []byte(yamlFilePrefixBytes), []byte(""), 1)
orbslam := builtin.ORBsettings{}
orbslam := viamorbslam3.ORBsettings{}
err = yaml.Unmarshal(yamlData, &orbslam)
test.That(t, err, test.ShouldBeNil)

Expand Down
2 changes: 1 addition & 1 deletion viam-orb-slam3/orbslam_server_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class SLAMServiceImpl final : public SLAMService::Service {
std::atomic<bool> use_live_data{false};
bool delete_processed_data = false;
// The size of the buffer has to be the same as
// dataBufferSize in RDK's builtin_test.go
// dataBufferSize in viam-orb-slam3_test.go
const int data_buffer_size = 4;
int first_processed_file_index = -1;
bool local_viewer_flag = false;
Expand Down

0 comments on commit 98bb1fd

Please sign in to comment.