diff --git a/cmd/mirror.go b/cmd/mirror.go index ddffae4da4..39e13ad888 100644 --- a/cmd/mirror.go +++ b/cmd/mirror.go @@ -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 } diff --git a/pkg/repository/model/model.go b/pkg/repository/model/model.go index 8bd6e994ce..725d87f6ab 100644 --- a/pkg/repository/model/model.go +++ b/pkg/repository/model/model.go @@ -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 } @@ -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 } @@ -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 } diff --git a/tests/tiup/test_tiup.sh b/tests/tiup/test_tiup.sh index 1f0890102a..fb72d94648 100755 --- a/tests/tiup/test_tiup.sh +++ b/tests/tiup/test_tiup.sh @@ -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 @@ -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