Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
Signed-off-by: lucklove <[email protected]>
  • Loading branch information
lucklove committed Nov 4, 2020
1 parent 52c9470 commit 1590f3a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 0 additions & 4 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,10 @@ func newMirrorIntroduceCmd() *cobra.Command {
// the privPath can point to a public key becase the Public method of KeyInfo works on both priv and pub key
privKey, err := loadPrivKey(privPath)
if err != nil {
// For test, should remove before merge
panic(err)
return err
}
pubKey, err := privKey.Public()
if err != nil {
// For test, should remove before merge
panic(err)
return err
}

Expand Down
1 change: 1 addition & 0 deletions pkg/repository/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func (l *localFilesystem) Introduce(id, name string, key *v1manifest.KeyInfo) er
return err
}

panic("For test")
return nil
}

Expand Down
11 changes: 7 additions & 4 deletions pkg/repository/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ func (m *model) Introduce(id, name string, key *v1manifest.KeyInfo) error {

keyID, err := key.ID()
if err != nil {
// For test, should remove before merge
panic(err)
return err
}

return utils.RetryUntil(func() error {
err = utils.RetryUntil(func() error {
var indexFileVersion *v1manifest.FileVersion
if err := m.updateIndexManifest(initTime, func(im *v1manifest.Manifest) (*v1manifest.Manifest, error) {
signed := im.Signed.(*v1manifest.Index)
Expand Down Expand Up @@ -115,10 +113,15 @@ func (m *model) Introduce(id, name string, key *v1manifest.KeyInfo) error {
return err
}

return m.txn.Commit()
err = m.txn.Commit()
panic(err)
return err
}, func(err error) bool {
return err == store.ErrorFsCommitConflict && m.txn.ResetManifest() == nil
})

panic(err)
return err
}

// Publish implements Model
Expand Down
1 change: 1 addition & 0 deletions pkg/repository/store/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (t *localTxn) Stat(filename string) (os.FileInfo, error) {

func (t *localTxn) Commit() error {
if err := t.store.lock(); err != nil {
panic(err)
return err
}
defer t.store.unlock()
Expand Down

0 comments on commit 1590f3a

Please sign in to comment.