Skip to content

Commit

Permalink
forgotten files
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jul 5, 2024
1 parent 02b4937 commit 2b67d20
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions storage/mysql/push_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mysql

import (
"context"
"os"
"testing"

"github.com/micromdm/nanomdm/storage/test"
)

func TestRetrievePushInfo(t *testing.T) {
testDSN := os.Getenv("NANOMDM_MYSQL_STORAGE_TEST_DSN")
if testDSN == "" {
t.Skip("NANOMDM_MYSQL_STORAGE_TEST_DSN not set")
}

storage, err := New(WithDSN(testDSN), WithDeleteCommands())
if err != nil {
t.Fatal(err)
}

test.TestRetrievePushInfo(t, context.Background(), storage)
}
19 changes: 19 additions & 0 deletions storage/test/push.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package test

import (
"context"
"testing"

"github.com/micromdm/nanomdm/storage"
)

func TestRetrievePushInfo(t *testing.T, ctx context.Context, s storage.PushStore) {
t.Run("TestRetrievePushInfo", func(t *testing.T) {
_, err := s.RetrievePushInfo(ctx, []string{"INVALID"})
if err != nil {
// should NOT recieve a "global" error for an enrollment that
// is merely invalid (or not enrolled yet, or not fully enrolled)
t.Errorf("should NOT have errored: %v", err)
}
})
}

0 comments on commit 2b67d20

Please sign in to comment.