fix(cmd): repair red main after #2238 and drop the RI hint on SP-only runs by IAmJSD · Pull Request #2243 · LeanerCloud/cloud-commitments-cli · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/csv_real_purchase_test.go
11 changes: 7 additions & 4 deletions cmd/multi_service_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func printMultiServiceSummary(allRecommendations []common.Recommendation, allRes
success := riAggregates.success + spStats.SuccessfulPurchases
failed := riAggregates.failed + spStats.FailedPurchases
printSuccessRate(success, failed)
printFinalMessage(isDryRun, success, failed)
printFinalMessage(isDryRun, riAggregates.success, success, failed)
}

// riAggregateStats holds aggregated RI statistics.
Expand Down Expand Up @@ -208,8 +208,9 @@ func printSuccessRate(success, failed int) {
const archeraSignupURL = common.ArcheraSignupURL

// printFinalMessage prints the final message based on mode and results.
// success and failed cover both Reserved Instances and Savings Plans.
func printFinalMessage(isDryRun bool, success, failed int) {
// success and failed cover both Reserved Instances and Savings Plans;
// riSuccess (the RI share of success) gates the RI-propagation hint.
func printFinalMessage(isDryRun bool, riSuccess, success, failed int) {
if isDryRun {
AppLogger.Println("\n💡 To actually purchase these commitments, run with --purchase flag")
return
Expand All @@ -219,7 +220,9 @@ func printFinalMessage(isDryRun bool, success, failed int) {
}
if success > 0 {
AppLogger.Println("\n🎉 Purchase operations completed!")
AppLogger.Println("⏰ Allow up to 15 minutes for RIs to appear in your account")
if riSuccess > 0 {
AppLogger.Println("⏰ Allow up to 15 minutes for RIs to appear in your account")
}
printArcheraPitch()
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/multi_service_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ func TestPrintFinalMessage(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
output := captureAppOutput(t, func() {
printFinalMessage(tt.isDryRun, tt.riSuccess, 0)
printFinalMessage(tt.isDryRun, tt.riSuccess, tt.riSuccess, 0)
})

for _, want := range tt.wantOutput {
Expand Down
39 changes: 39 additions & 0 deletions cmd/purchase_failure_exit_2157_test.go
Loading