зеркало из https://github.com/github/vitess-gh.git
Addition of load release summary function
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
This commit is contained in:
Родитель
43ce83280d
Коммит
816e1fd3e5
|
@ -20,6 +20,7 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -366,6 +367,14 @@ func createSortedPrTypeSlice(prPerType prsByType) []sortedPRType {
|
|||
return data
|
||||
}
|
||||
|
||||
func releaseSummary(summaryFile string) (string, error) {
|
||||
contentSummary, err := ioutil.ReadFile(summaryFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(contentSummary), nil
|
||||
}
|
||||
|
||||
func getOutput(fileout string) (*os.File, error) {
|
||||
if fileout == "" {
|
||||
return os.Stdout, nil
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -104,3 +105,20 @@ TEST@planetscale.com docker/lite/install_dependencies.sh: Upgrade MySQL 8 to 8.
|
|||
assert.Equal(t, authorCommits, []string{"385d0b327", "3b744e782", "4a0a943b0", "538709da5", "616f5562c", "6b9a731a2", "e5242a88a", "edac2baf8"})
|
||||
assert.Equal(t, 28, nonMergeCommits)
|
||||
}
|
||||
|
||||
func TestLoadSummaryReadme(t *testing.T) {
|
||||
readmeFile, err := ioutil.TempFile("", "*.md")
|
||||
require.NoError(t, err)
|
||||
|
||||
readmeContent := `- New Gen4 feature
|
||||
- Self hosted runners
|
||||
- Bunch of features
|
||||
`
|
||||
|
||||
err = ioutil.WriteFile(readmeFile.Name(), []byte(readmeContent), 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
str, err := releaseSummary(readmeFile.Name())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, str, readmeContent)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче