South Africa 188 for 5 (De Kock 66, Herath 3-22) beat Sri Lanka 279 for 7 (Dilshan 100, Mathews 58) by five wickets (D/L method)
South Africa got the pressure situation they wanted to practice ahead of a major tournament - they were without regular captain AB de Villiers due to tightness in the hip, were under the cosh for 44.4 overs in the field, weathered three rain delays and two reduced targets -and they rose above it.
They were 116 for 0 after 15 overs and the chase seemed fairly simple, but South Africa lost 5 for 51 and seemed in serious danger. Calm was needed and was found in Rilee Rossouw and Vernon Philander, who took them home with three balls to spare.
Sri Lanka will not be happy with how they let things slip, especially after Tillakaratne Dilshan scored his fourth century in eight matches against international opposition, albeit not in an official ODI, to set up a solid total. He set the platform for Angelo Mathews to accelerate and Sri Lanka would have soared above 300 had rain not curtailed their innings.
That didn't matter when they left Lasith Malinga with just four to defend in the final over.
Malinga made his return after almost five months out of the game to recover from ankle surgery, bowled three overs upfront and two at the death but could not pull off the toe-crunching paralysis he is known for. Although he maintained his pace and showed no discomfort, he conceded 12 runs in his second over and 13 in his fourth, which swung the pendulum South Africa's way at the beginning and end of the match.
Hashim Amla was the first to take advantage of Malinga's rustiness with a couple of fours to kick off a 116-run opening stand. De Kock, his partner, appeared at ease coming back from his own ankle injury and was particularly harsh on Sachithra Senanayake, plundering 19 runs before the rains came down.
Repetitive showers were a theme for the day and they meant Sri Lanka were unable to bat their full 50 overs and South Africa's target too had been reduced to 224 off 30 overs and then to 188 off 25 overs.
Rangana Herath removed de Kock and Amla immediately after the second delay to leave Faf du Plessis and JP Duminy with a tricky situation.
Conscious of the required rate rising towards eight, Duminy stepped out to Herath and was stumped in the 20th over. When David Miller was bowled in the next and South Africa needed 40 off the last four overs.
Du Plessis eased some of the nerves by taking 10 runs off the first three balls of Malinga's penultimate over under the revised conditions. Du Plessis was dismissed after that but had done the bulk of the damage and left it to the lower middle-order to finish off. This time, they did exactly that.
Sri Lanka, though, would be concerned about their middle and lower order. Dilshan anchored the first half of their innings, the rest failed to push on against a South African attack that looked like they'd rather be anywhere but bowling in 13 C weather and swirling wind.
Dilshan raced from 63 off 69 balls to a century 13 deliveries later, with the spinners taking punishment at a venue with inviting straight boundaries. Dimuth Karunaratne also took advantage of that opportunity and broke through a lean patch with a composed 46, but was caught off the bowling of Wayne Parnell, who also accounted for Dinesh Chandimal. Mathews pushed on though. He was batting in his first innings for nearly three weeks after injury and illness, but will remain concerned about Sri Lanka's inability to seize the big moments in New Zealand, especially as the World Cup draws nearer.