mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] update config types to use bytesize.Size (#828)
* update config size types to use bytesize.Size * submit unchecked-out file ... 🤦 * fix bytesize config var decoding * bump bytesize version * update kim's libraries in readme * update envparse.sh to output more useful errors * improve envparse.sh * remove reliance on jq * instead, use uint64 for bytesize flag types * remove redundant type * fix viper unmarshaling * Update envparsing.sh * fix envparsing test Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
This commit is contained in:
@@ -43,13 +43,13 @@ type ManagerTestSuite struct {
|
||||
func (suite *ManagerTestSuite) TestEmojiProcessBlocking() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/rainbow-original.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
emojiID := "01GDQ9G782X42BAMFASKP64343"
|
||||
@@ -104,13 +104,13 @@ func (suite *ManagerTestSuite) TestEmojiProcessBlocking() {
|
||||
func (suite *ManagerTestSuite) TestEmojiProcessBlockingTooLarge() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/big-panda.gif")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
emojiID := "01GDQ9G782X42BAMFASKP64343"
|
||||
@@ -128,13 +128,13 @@ func (suite *ManagerTestSuite) TestEmojiProcessBlockingTooLarge() {
|
||||
func (suite *ManagerTestSuite) TestEmojiProcessBlockingTooLargeNoSizeGiven() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/big-panda.gif")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
emojiID := "01GDQ9G782X42BAMFASKP64343"
|
||||
@@ -152,7 +152,7 @@ func (suite *ManagerTestSuite) TestEmojiProcessBlockingTooLargeNoSizeGiven() {
|
||||
func (suite *ManagerTestSuite) TestEmojiProcessBlockingNoFileSizeGiven() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/rainbow-original.png")
|
||||
if err != nil {
|
||||
@@ -214,13 +214,13 @@ func (suite *ManagerTestSuite) TestEmojiProcessBlockingNoFileSizeGiven() {
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessBlocking() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
@@ -286,7 +286,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlocking() {
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingNoContentLengthGiven() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
@@ -359,7 +359,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingNoContentLengthGiven
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingReadCloser() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// open test image as a file
|
||||
f, err := os.Open("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
@@ -432,13 +432,13 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingReadCloser() {
|
||||
func (suite *ManagerTestSuite) TestPngNoAlphaChannelProcessBlocking() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-png-noalphachannel.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
@@ -504,13 +504,13 @@ func (suite *ManagerTestSuite) TestPngNoAlphaChannelProcessBlocking() {
|
||||
func (suite *ManagerTestSuite) TestPngAlphaChannelProcessBlocking() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-png-alphachannel.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
@@ -576,13 +576,13 @@ func (suite *ManagerTestSuite) TestPngAlphaChannelProcessBlocking() {
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithCallback() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
// test the callback function by setting a simple boolean
|
||||
@@ -659,13 +659,13 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithCallback() {
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessAsync() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
@@ -744,9 +744,9 @@ func (suite *ManagerTestSuite) TestSimpleJpegQueueSpamming() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
return bytes.NewReader(b), len(b), nil
|
||||
return bytes.NewReader(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
@@ -820,13 +820,13 @@ func (suite *ManagerTestSuite) TestSimpleJpegQueueSpamming() {
|
||||
func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() {
|
||||
ctx := context.Background()
|
||||
|
||||
data := func(_ context.Context) (io.Reader, int, error) {
|
||||
data := func(_ context.Context) (io.Reader, int64, error) {
|
||||
// load bytes from a test image
|
||||
b, err := os.ReadFile("./test/test-jpeg.jpg")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.NewBuffer(b), len(b), nil
|
||||
return bytes.NewBuffer(b), int64(len(b)), nil
|
||||
}
|
||||
|
||||
accountID := "01FS1X72SK9ZPW0J1QQ68BD264"
|
||||
|
Reference in New Issue
Block a user