Skip to content

Commit

Permalink
fix TestEscrowBuddy/TestEscrowBuddyRotatesKey test
Browse files Browse the repository at this point in the history
  • Loading branch information
roperzh committed Sep 24, 2024
1 parent 31ac408 commit 82cdf3f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions orbit/pkg/update/escrow_buddy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ func (s *escrowBuddyTestSuite) TestEscrowBuddyRotatesKey() {

err = r.Run(cfg)
require.NoError(t, err)
require.Len(t, cmdCalls, 1)
require.Len(t, cmdCalls, 2)
require.Equal(t, cmdCalls[0]["cmd"], "sh")
require.Equal(t, cmdCalls[0]["args"], []string{"-c", "defaults write /Library/Preferences/com.netflix.Escrow-Buddy.plist GenerateNewKey -bool true"})
require.Equal(t, cmdCalls[0]["args"], []string{"-c", "/Library/Security/SecurityAgentPlugins/Escrow\\ Buddy.bundle/Contents/Resources/AuthDBSetup.sh"})
require.Equal(t, cmdCalls[1]["cmd"], "sh")
require.Equal(t, cmdCalls[1]["args"], []string{"-c", "defaults write /Library/Preferences/com.netflix.Escrow-Buddy.plist GenerateNewKey -bool true"})

targets = runner.updater.opt.Targets
require.Len(t, targets, 1)
Expand All @@ -77,10 +79,12 @@ func (s *escrowBuddyTestSuite) TestEscrowBuddyRotatesKey() {

time.Sleep(3 * time.Millisecond)
cfg.Notifications.RotateDiskEncryptionKey = false
cmdCalls = []map[string]any{}
err = r.Run(cfg)
require.NoError(t, err)
require.Len(t, cmdCalls, 2)
require.Equal(t, cmdCalls[1]["cmd"], "sh")
require.Equal(t, cmdCalls[1]["args"], []string{"-c", "defaults write /Library/Preferences/com.netflix.Escrow-Buddy.plist GenerateNewKey -bool false"})
// only one call to set the GenerateNewKey to false
require.Len(t, cmdCalls, 1)
require.Equal(t, cmdCalls[0]["cmd"], "sh")
require.Equal(t, cmdCalls[0]["args"], []string{"-c", "defaults write /Library/Preferences/com.netflix.Escrow-Buddy.plist GenerateNewKey -bool false"})

}

0 comments on commit 82cdf3f

Please sign in to comment.