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 3, 2020
1 parent 7ced4be commit 52c9470
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,14 @@ 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
10 changes: 10 additions & 0 deletions pkg/repository/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ 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
}

Expand Down Expand Up @@ -81,12 +83,16 @@ func (m *model) Introduce(id, name string, key *v1manifest.KeyInfo) error {
indexFileVersion = &v1manifest.FileVersion{Version: signed.Version + 1}
return im, nil
}); err != nil {
// For test, should remove before merge
panic(err)
return err
}

if indexFi, err := m.txn.Stat(fmt.Sprintf("%d.index.json", indexFileVersion.Version)); err == nil {
indexFileVersion.Length = uint(indexFi.Size())
} else {
// For test, should remove before merge
panic(err)
return err
}

Expand All @@ -97,11 +103,15 @@ func (m *model) Introduce(id, name string, key *v1manifest.KeyInfo) error {
}
return om
}); err != nil {
// For test, should remove before merge
panic(err)
return err
}

// Update timestamp.json and signature
if err := m.updateTimestampManifest(initTime); err != nil {
// For test, should remove before merge
panic(err)
return err
}

Expand Down
2 changes: 2 additions & 0 deletions tests/tiup/test_tiup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ EOF
chmod 755 /tmp/hello.sh
tar -C /tmp -czf /tmp/hello.tar.gz hello.sh

echo "test mirror"
tiup mirror genkey

tiup mirror init /tmp/test-mirror-a
Expand All @@ -62,6 +63,7 @@ tiup mirror set /tmp/test-mirror-a
tiup mirror merge /tmp/test-mirror-b
tiup hello:v0.0.2 | grep TiDB

echo "test uninstall"
tiup uninstall
tiup uninstall tidb:v3.0.13
tiup uninstall tidb --all
Expand Down

0 comments on commit 52c9470

Please sign in to comment.