profile
viewpoint
Alex Grin lyoshenka @LBRYio, @Topscore Boston, MA https://grin.io

lyoshenka/cloudflare-ddns 139

Simple, free dynamic DNS via Cloudflare

lyoshenka/awesome-motherfucking-website 11

An awesome list of websites about minimal web design and copious swearing

lyoshenka/begemot 4

Jekyll by email

lyoshenka/betterGB 2

Chrome extension to make the Google Bookmarks bookmarklet suck less.

lyoshenka/ama 1

Ask Grin anything!

lyoshenka/colour-mysql-console 1

Sample config files showing how to colorize linux console mysql client

lyoshenka/curl 1

A better way to use curl in PHP

lyoshenka/0bin 0

Client side encrypted pastebin

lyoshenka/1thingtoday 0

1thingtoday.com's Tumblr Theme

starteddeathau/markdown-clipper

started time in 4 hours

startedlawl/NoiseTorch

started time in 10 days

push eventlbryio/ytsync

Mark Beamer Jr

commit sha 64040ea67a50a34f8be53996e3b7a2e272a13d51

Add calls to internal-apis and add get released date if available.

view details

Mark Beamer Jr

commit sha 81e9378b9d12a498c11a1858ba6734b80a8956a3

Add new fall through errors for release time

view details

Mark Beamer Jr

commit sha ad2742547174138b1d59aeb75b9ae9a37970d52f

Add ip switching for being blocked

view details

Mark Beamer Jr

commit sha b1e10e7b09ccffafc657f8eae45b829d36542ae4

Add retry on IP failures

view details

Mark Beamer Jr

commit sha a1caea4a2892a2726eac8c5070421d273002a450

added logging

view details

Mark Beamer Jr

commit sha 140353097e05d799e0cccdd35449c689929fa742

added logging

view details

Mark Beamer Jr

commit sha 4d56339756841304706b7dcd13fcd0f8949584df

fixed appending args

view details

Mark Beamer Jr

commit sha c7c220ecd33e7219d0524157acd6408ef9d5305d

Dont always fall through on every error.

view details

Mark Beamer Jr

commit sha cd11e826761a6fbbd2c3a3f8738a1922a3a709de

Dont always fall through on every error. Add user agent to calls

view details

Mark Beamer Jr

commit sha 4eba7200d80a65a738421e5f15787667c64a2eff

user agent breaks it

view details

Mark Beamer Jr

commit sha 13543b20e990b162c399793a370ebdde266fd38f

Don't use api unless the video is from the past 5 days, otherwise just use the upload date from youtube donwloader change interface to int for now known field.

view details

Mark Beamer Jr

commit sha fc18151d777934c431906084e09c14e95a08c359

Increase max db limit Increase wallet startup time allotment for big channels Set FPS to float instead of int

view details

Mark Beamer Jr

commit sha 5be3551abee2cec6db15b096546aba2c87a5cf7d

Mark video failed if we cannot get video info instead of failing the sync Turn on error log after fixing lockup Try different user agents if calls fail Prevent double processing a channel in a row, just fail the sync instead

view details

Mark Beamer Jr

commit sha 7f1906d58bb463d8daff5479cd43708cc51fbd6d

change FPS to float from int

view details

Mark Beamer Jr

commit sha 41fd9f6844c584e7b5756a19e124f0f44867c4f4

fix string parameter for error message

view details

Niko Storni

commit sha 751bc84ce59b65dd4b00bb3b411026a2f8b5e432

grab channel info without APIs fix new channel syncs fix e2e tests

view details

Niko Storni

commit sha eab9bcf1ffd1d9a689cb25867286d58249b569a6

don't wait for confirmations unnecessarily fix sqlite crap

view details

Alex Grintsvayg

commit sha 6c6e93cefc27b7ff388b34908e9ecf433ecab630

go mod tidy

view details

push time in 10 days

push eventlbryio/lbry.com

Alex Grintsvayg

commit sha 851785ecf1a8fdbc9b2e047895a30974c92ecfcc

Revert "Revert "turn yt sync back on"" This reverts commit c1b3b62b32a073cb4211459e81a4bd8b5cf8dc8e.

view details

push time in 12 days

push eventlbryio/lbry.com

Alex Grintsvayg

commit sha c1b3b62b32a073cb4211459e81a4bd8b5cf8dc8e

Revert "turn yt sync back on" This reverts commit 93ca75d1a27b157ab4d791fc106cf722725e91a7.

view details

push time in 12 days

push eventlbryio/lbry.com

Alex Grintsvayg

commit sha 93ca75d1a27b157ab4d791fc106cf722725e91a7

turn yt sync back on

view details

push time in 12 days

push eventlbryio/lbry.com

Alex Grin

commit sha fb9a959cc2282257619c91a79a1c228348a95ba9

Update youtube.php

view details

push time in 16 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 2da7b31fe91f12b32063cca3bda714e7fa57d76a

a pubrelay microservice

view details

push time in 17 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 9aea4113d523a109e55d4a3a0feac122e11c2acd

a pubrelay microservice

view details

push time in 17 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 537fe586c8793dafba17d65f7ebb2f600cb8cf20

a pubrelay microservice

view details

push time in 17 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 85cb43d587e19b14ae388047626a042411145d80

a pubrelay microservice

view details

push time in 17 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 357aebbccee9a4d0da7158319f9800e9df3199c8

less loud

view details

push time in 18 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 0eef62b5fd073238e3c12a931eb1fef4fa3b367a

i made a huge mess. sorry future me, when you're digging through this

view details

push time in 18 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha a3dd3dc626d7731fa210e7df3a6aa3cc8f506122

WIP: trying to get the accurate api to work

view details

push time in 18 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha f942bf802526c32be8d5716a838c4faa3047d461

get upload time from https://www.invid-project.eu/tools-and-services/invid-verification-plugin/

view details

push time in 18 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha a05864404da99260d872f6bb314806aeddfd9eb8

use local timezone for youtube-dl, even though its not certain

view details

push time in 19 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 70ad891dfa61de4376a98f2251563580c0541813

use durations

view details

push time in 19 days

startedgo-vgo/robotgo

started time in 19 days

startedzutrinken/attila

started time in 19 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha b59ef282676bf98ca2afb2cfee03f12262cf80d7

punting on ChannelInfo for now

view details

push time in 19 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha 1369ed0b48e21761f7439140dbd57df355fd9f9c

replace yt channel video count with a scrape of socialblade.com

view details

push time in 19 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha bffc0823be2a787df76397bd096cc918238b5cd3

more

view details

push time in 19 days

push eventlbryio/ytsync

Alex Grintsvayg

commit sha edbb22fcf0d06169481e2cdd35e515657204bcec

rename

view details

push time in 19 days

create barnchlbryio/ytsync

branch : fuck-yt

created branch time in 19 days

push eventlyoshenka/burner.kiwi

Alex Grintsvayg

commit sha 2eed351481ee3fb4aa8838eca08d3abe574b94ab

update dependencies to a set that works

view details

push time in 19 days

fork lyoshenka/burner.kiwi

No bullshit temporary mail service written in Go

fork in 19 days

push eventlyoshenka/grin.io

Alex Grintsvayg

commit sha 645b21e2414fd8e3f0afcae5824631c755b20f03

add subscribe page

view details

push time in 23 days

startedbalajis/twitter-export

started time in 23 days

push eventlyoshenka/phpstorm-config

Alex Grintsvayg

commit sha bcc00f9a3e9432602c804fe46d4db371a273d233

x

view details

push time in 24 days

startedmarkbates/pkger

started time in 25 days

startedroam-unofficial/roam-toolkit

started time in 25 days

startedroam-unofficial/awesome-roam

started time in 25 days

startedZettlr/Zettlr

started time in 25 days

startedpiroor/tweet.sh

started time in a month

startedtwintproject/twint

started time in a month

startedbisguzar/twitter-scraper

started time in a month

startedttezel/twit

started time in a month

push eventlyoshenka/grin.io

Alex Grintsvayg

commit sha 5e78158b5180034fe98c9b935eff8c6fcba8c0a2

keep it simple

view details

push time in a month

push eventlyoshenka/grin.io

Alex Grintsvayg

commit sha 3d5a576d09cab55447a44677148bc32dc714db6f

add redirect

view details

Alex Grintsvayg

commit sha 8f0e2826e3600e9d8837c2ddd45c9c2b75a8c77f

number the coding maxims

view details

push time in a month

startedalbertito/chasquid

started time in a month

startedtomav/docker-mailserver

started time in a month

issue commentlbryio/lbry-latam

Give lbry.lat retention data

Can you give me the query for the lbry.lat segment? I'll try it out.

kauffj

comment created time in a month

issue commentlbryio/lbry-latam

Give lbry.lat retention data

In my system lbry.lat would have to be its own segment.

If this is more about "how do we let non-employees see retention data", that part is pretty simple. The API to get the data will be part of internal apis, so we can use the same permissions system we already have.

kauffj

comment created time in a month

push eventlyoshenka/papers

Alex Grintsvayg

commit sha d38a1ffd2a10c1accb4298ed8b1cc273c558fa5d

add lbry paper

view details

push time in a month

startedpazz/alot

started time in a month

Pull request review commentlbryio/lbrytv

Initial commit for collector app

+DatabaseDSN: postgres://collector:ZnPfJ!4vTb-nURv8M!JkkuAcjYLYbkiX@localhost:5433

or are these just for testing/docker?

andybeletsky

comment created time in a month

Pull request review commentlbryio/lbrytv

Initial commit for collector app

+DatabaseDSN: postgres://collector:ZnPfJ!4vTb-nURv8M!JkkuAcjYLYbkiX@localhost:5433

should these passwords be in here and in sqlboiler.toml?

andybeletsky

comment created time in a month

Pull request review commentlbryio/lbrytv

Initial commit for collector app

+package collector++type EventBuffering struct {+	URL            string `json:"url"`+	Position       int    `json:"position"`+	Duration       *int   `json:"duration,omitempty"`+	StreamDuration *int   `json:"stream_duration,omitempty"`+	StreamBitrate  *int   `json:"stream_bitrate,omitempty"`+}++type PlaybackStart struct {+	// media bitrate, bits/sec (if known)+	StreamBitrate *int `json:"stream_bitrate,omitempty"`+	// stream duration, seconds+	StreamDuration *int `json:"stream_duration,omitempty"`+	// time before playback started, milliseconds

these comments make me think that the names of the fields are not clear enough. the name should tell you exactly what the thing is.

also, making some fields be seconds and some be milliseconds is a recipe for mistakes. pick one or the other and make all times be that.

andybeletsky

comment created time in a month

Pull request review commentlbryio/lbrytv

Initial commit for collector app

+openapi: "3.0.0"

ive been looking forward to using openapi :+1:

andybeletsky

comment created time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha ef8577a739a395b7e098f9f920be22b759da7b44

autoclean

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha b01bb63c8a9854ddfbf2e2c1b592cec0c060dd58

add service file

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha 6032720dd2b106234b411e1d208b287df92d4a4e

smarter url creation

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha ad68dd48a8d5f42e4fec67e116c0b5b73c300f99

compile in static assets

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha 1fa0293aeed4b693320dd375ff1bfc4633258c98

remove kinks

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha f7e14d655b7421f9e66ff5c20e70d2c40c45190b

we have a homepage

view details

Alex Grintsvayg

commit sha 33dfcc8446dafb6eae0826f1478281fb28bea66b

remove kinks

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha 3528b03e99e157ad1b6987847b903e767d2ba90c

we have a homepage

view details

push time in a month

push eventlyoshenka/txt

Alex Grintsvayg

commit sha 470cfc075b50208b7d3c892c083160d60595dd55

v1 that works

view details

push time in a month

create barnchlyoshenka/txt

branch : old

created branch time in a month

startedcaddyserver/certmagic

started time in a month

startedhihayk/scale

started time in a month

PR opened lbryio/ytsync

Reviewers
bump lbry.go dependency to be compatible with internal-apis dependenc…

…y bump

+4 -2

0 comment

3 changed files

pr created time in a month

create barnchlbryio/ytsync

branch : latest-lbry.go

created branch time in a month

push eventlbryio/lbry.go

Alex Grintsvayg

commit sha fcade747532328a30217fac249a698ccffb0d86c

export query.Placeholders

view details

push time in a month

push eventlyoshenka/grinfit

Alex Grintsvayg

commit sha f46f563ee3d09e8e710b8f3c4163badcd161755e

delete dupe workouts

view details

Alex Grintsvayg

commit sha e2e4906f1e442cf507787d451ab12b0d46d565a2

minor

view details

push time in a month

push eventlyoshenka/grinfit

Alex Grintsvayg

commit sha 5a3f2a98e538c17c0a6f99d5109ecddf0cd8b51e

build before pushing

view details

push time in a month

push eventlyoshenka/grinfit

Alex Grintsvayg

commit sha 330aa993b7799cac5953ef313e36cc31a4e1757a

publish: new content generated from commit ad1321ca34edb2f2ef3170829e6ff8fd6a888fe1

view details

push time in a month

push eventlyoshenka/grinfit

Alex Grintsvayg

commit sha ad1321ca34edb2f2ef3170829e6ff8fd6a888fe1

new content

view details

push time in a month

push eventlyoshenka/grinfit

Alex Grintsvayg

commit sha 4768a922d3a992c790a5c618be03930cd6968ae1

new content

view details

push time in a month

startedGitMurf/roam-highlighter

started time in a month

startedbslatkin/cohorts

started time in a month

push eventlyoshenka/grin.io

Alex Grintsvayg

commit sha 7a667841370add3b39dfc226a4b89f5298c2dcf2

someday this will be a grin

view details

Alex Grintsvayg

commit sha 50e20c5f4fd167631bcfaa88728f47b30a998335

post: working from home

view details

push time in a month

startedcaiorss/bookmarklet-maker

started time in a month

startedleggett/simplify

started time in a month

startedplibither8/markdown-new-tab

started time in a month

push eventlbryio/reflector.go

Alex Grintsvayg

commit sha 382e228f4cb16230a8206907bff403143c0d7ffd

test wallet server connection

view details

Alex Grintsvayg

commit sha 4b0be279529fe35f0a6507c76fe2bfe950c220b3

successfully shut down wallet server

view details

push time in a month

startedprathyvsh/notation

started time in a month

push eventlyoshenka/github-starred-to-pinboard

Alex Grintsvayg

commit sha f8fa3a4536128c6de3a5194185a6c5283e405d84

use HTTPBasicAuth

view details

Alex Grintsvayg

commit sha c9133b117a688c88794648e43e3dfa7f8fd718fd

switch to python3 and handle leading BOM in json data

view details

push time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

I'm not quite buying the domain analogy. We have a global naming system, so we only have one domain (the LBRY network). Or maybe you could say that each channel is its own domain. There's no way each claim is its own domain.

eukreign

comment created time in 2 months

push eventlbryio/lbry-desktop

Alex Grin

commit sha c78b93e640b7327fe92b6c86d4cd974aee5f3de0

typo

view details

push time in 2 months

PR opened lbryio/lbry-desktop

Reviewers
minor typo
+1 -1

0 comment

1 changed file

pr created time in 2 months

create barnchlbryio/lbry-desktop

branch : lyoshenka-patch-1

created branch time in 2 months

startedpinry/pinry

started time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

still not sold on this approach to subresources though. why not make a separate claim for each resource and then reference those in the top-level claim?

eukreign

comment created time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

great idea about /. that's the character we should use for subresources. then we don't even need to introduce ~.

eukreign

comment created time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

I unassigned Jack because I think we need to think this through some more before we implement it.

eukreign

comment created time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

Now that I've read this, I'm starting to think that adding ~ to indicate subresources is not the right design (even though I'm the one who suggested this initially). It doesn't feel right. HTTP doesn't have subresources. They just have URLs that point to things and you never have to think about whether a URL is a top-level resource (and has the accompanying metadata) or a subresource (and does not).

Maybe this distinction is important for us to make in a way that's not important in HTTP?

eukreign

comment created time in 2 months

issue commentlbryio/lbry-sdk

claim resources feature proposal

My thoughts:

  1. Let's use : instead of '#' (related: https://github.com/lbryio/lbry-sdk/issues/2832)
  2. I'd much rather the new behavior go into get instead of resolve. Resolve takes a URL and returns a claim. Get takes a URL and returns data. This eliminates the need for a new API endpoint and for the browser to guess which endpoint to call. It's also a very small semantic change for get: if the URL has a ~ in it, return the data for the subresource instead of the top-level resource.
  3. This doesn't describe how publishing a markdown file with 10 embedded images would work. If I'm understanding your proposed protobuf correctly, each image would get at least two blobs (an sd blob and a content blob). Is that right?
eukreign

comment created time in 2 months

push eventlyoshenka/grintsvayg.com

Alex Grin

commit sha 0c777ec7dc46362a688fef7fae2093568dc8a374

Update index.html

view details

push time in 2 months

push eventlyoshenka/pinback

Alex Grintsvayg

commit sha 29f88789d9578cbdd708835d50740eaa602966c1

trim BOM mark

view details

push time in 2 months

startedmotemen/go-loghttp

started time in 2 months

startedsellleon/buckets

started time in 2 months

starteduprtcl/spec

started time in 2 months

startedfraction/oasis

started time in 2 months

Pull request review commentlbryio/lbrytv

Improvement/status

 const ( )  type ServerItem struct {

The fields of the struct have to be exported, but the struct itself does not.

andybeletsky

comment created time in 2 months

startedrsc/2fa

started time in 2 months

startedveggiedefender/torrent-client

started time in 2 months

startedveggiedefender/luks_backdoor

started time in 2 months

Pull request review commentlbryio/lbrytv

Improvement/status

+package status++import (+	"encoding/json"+	"io/ioutil"+	"net/http"+	"net/http/httptest"+	"os"+	"testing"++	"github.com/lbryio/lbrytv/app/auth"+	"github.com/lbryio/lbrytv/app/sdkrouter"+	"github.com/lbryio/lbrytv/app/wallet"+	"github.com/lbryio/lbrytv/config"+	"github.com/lbryio/lbrytv/internal/storage"+	"github.com/lbryio/lbrytv/internal/test"+	"github.com/lbryio/lbrytv/models"++	"github.com/stretchr/testify/assert"+	"github.com/stretchr/testify/require"+)++func TestMain(m *testing.M) {+	// These tests requires an environment close to production setup, i.e. no loading from the config+	config.Override("LbrynetServers", map[string]string{})+	defer config.RestoreOverridden()++	dbConfig := config.GetDatabase()+	params := storage.ConnParams{+		Connection: dbConfig.Connection,+		DBName:     dbConfig.DBName,+		Options:    dbConfig.Options,+	}+	c, connCleanup := storage.CreateTestConn(params)+	c.SetDefaultConnection()++	defer connCleanup()++	os.Exit(m.Run())+}++func TestGetStatusV2_Unauthenticated(t *testing.T) {+	rr := httptest.NewRecorder()+	r, _ := http.NewRequest("GET", "", nil)+	provider := func(token, ip string) (*models.User, error) { return nil, nil }+	rt := sdkrouter.New(config.GetLbrynetServers())+	handler := sdkrouter.Middleware(rt)(auth.Middleware(provider)(http.HandlerFunc(GetStatusV2)))+	handler.ServeHTTP(rr, r)+	response := rr.Result()+	respBody, err := ioutil.ReadAll(response.Body)+	require.NoError(t, err)++	assert.Equal(t, http.StatusOK, response.StatusCode)+	var respStatus statusResponse+	err = json.Unmarshal(respBody, &respStatus)+	require.NoError(t, err)++	assert.Equal(t, statusOK, respStatus["general_state"], respStatus)+	assert.Nil(t, respStatus["user"])+}++func TestGetStatusV2_UnauthenticatedOffline(t *testing.T) {+	_, err := models.LbrynetServers().UpdateAllG(models.M{"address": "http://malfunctioning/"})+	require.NoError(t, err)+	defer func() {+		models.LbrynetServers().UpdateAllG(models.M{"address": "http://localhost:5279/"})+	}()++	rr := httptest.NewRecorder()+	r, _ := http.NewRequest("GET", "", nil)+	provider := func(token, ip string) (*models.User, error) { return nil, nil }+	rt := sdkrouter.New(config.GetLbrynetServers())+	handler := sdkrouter.Middleware(rt)(auth.Middleware(provider)(http.HandlerFunc(GetStatusV2)))+	handler.ServeHTTP(rr, r)+	response := rr.Result()+	respBody, err := ioutil.ReadAll(response.Body)+	require.NoError(t, err)++	assert.Equal(t, http.StatusOK, response.StatusCode)+	var respStatus statusResponse+	err = json.Unmarshal(respBody, &respStatus)+	require.NoError(t, err)++	assert.Equal(t, statusFailing, respStatus["general_state"])+	lbrynetStatus := respStatus["services"].(map[string]interface{})["lbrynet"].(map[string]interface{})

:woozy_face:

andybeletsky

comment created time in 2 months

Pull request review commentlbryio/lbrytv

Improvement/status

+package status++import (+	"encoding/json"+	"io/ioutil"+	"net/http"+	"net/http/httptest"+	"os"+	"testing"++	"github.com/lbryio/lbrytv/app/auth"+	"github.com/lbryio/lbrytv/app/sdkrouter"+	"github.com/lbryio/lbrytv/app/wallet"+	"github.com/lbryio/lbrytv/config"+	"github.com/lbryio/lbrytv/internal/storage"+	"github.com/lbryio/lbrytv/internal/test"+	"github.com/lbryio/lbrytv/models"++	"github.com/stretchr/testify/assert"+	"github.com/stretchr/testify/require"+)++func TestMain(m *testing.M) {+	// These tests requires an environment close to production setup, i.e. no loading from the config+	config.Override("LbrynetServers", map[string]string{})+	defer config.RestoreOverridden()++	dbConfig := config.GetDatabase()+	params := storage.ConnParams{+		Connection: dbConfig.Connection,+		DBName:     dbConfig.DBName,+		Options:    dbConfig.Options,+	}+	c, connCleanup := storage.CreateTestConn(params)+	c.SetDefaultConnection()++	defer connCleanup()++	os.Exit(m.Run())+}++func TestGetStatusV2_Unauthenticated(t *testing.T) {+	rr := httptest.NewRecorder()+	r, _ := http.NewRequest("GET", "", nil)+	provider := func(token, ip string) (*models.User, error) { return nil, nil }+	rt := sdkrouter.New(config.GetLbrynetServers())+	handler := sdkrouter.Middleware(rt)(auth.Middleware(provider)(http.HandlerFunc(GetStatusV2)))+	handler.ServeHTTP(rr, r)+	response := rr.Result()+	respBody, err := ioutil.ReadAll(response.Body)+	require.NoError(t, err)++	assert.Equal(t, http.StatusOK, response.StatusCode)+	var respStatus statusResponse+	err = json.Unmarshal(respBody, &respStatus)+	require.NoError(t, err)++	assert.Equal(t, statusOK, respStatus["general_state"], respStatus)+	assert.Nil(t, respStatus["user"])+}++func TestGetStatusV2_UnauthenticatedOffline(t *testing.T) {+	_, err := models.LbrynetServers().UpdateAllG(models.M{"address": "http://malfunctioning/"})+	require.NoError(t, err)+	defer func() {+		models.LbrynetServers().UpdateAllG(models.M{"address": "http://localhost:5279/"})+	}()++	rr := httptest.NewRecorder()+	r, _ := http.NewRequest("GET", "", nil)+	provider := func(token, ip string) (*models.User, error) { return nil, nil }+	rt := sdkrouter.New(config.GetLbrynetServers())+	handler := sdkrouter.Middleware(rt)(auth.Middleware(provider)(http.HandlerFunc(GetStatusV2)))+	handler.ServeHTTP(rr, r)+	response := rr.Result()+	respBody, err := ioutil.ReadAll(response.Body)+	require.NoError(t, err)++	assert.Equal(t, http.StatusOK, response.StatusCode)+	var respStatus statusResponse+	err = json.Unmarshal(respBody, &respStatus)+	require.NoError(t, err)++	assert.Equal(t, statusFailing, respStatus["general_state"])+	lbrynetStatus := respStatus["services"].(map[string]interface{})["lbrynet"].(map[string]interface{})+	assert.EqualValues(+		t,+		statusOffline,+		lbrynetStatus["status"],+	)+	assert.Regexp(+		t,+		"dial tcp: lookup malfunctioning",+		lbrynetStatus["error"],+	)+	assert.Nil(t, respStatus["user"])+}++func TestGetStatusV2_Authenticated(t *testing.T) {+	ts := test.MockHTTPServer(nil)+	defer ts.Close()+	ts.NextResponse <- `{+	"success": true,+	"error": null,+	"data": {+		"user_id": 123,+		"has_verified_email": true+  	}+}`++	rr := httptest.NewRecorder()+	r, _ := http.NewRequest("GET", "", nil)+	r.Header.Add(wallet.TokenHeader, "anystringwilldo")+	rt := sdkrouter.New(config.GetLbrynetServers())+	handler := sdkrouter.Middleware(rt)(auth.Middleware(auth.NewIAPIProvider(rt, ts.URL))(http.HandlerFunc(GetStatusV2)))

also :woozy_face:, and i think you pointed this out to me in the past. maybe we could have a middleware.Apply function that takes a handler and a slice of middlewares and applies them? would be more readable

andybeletsky

comment created time in 2 months

Pull request review commentlbryio/lbrytv

Improvement/status

+package status++import (+	"encoding/json"+	"io/ioutil"+	"net/http"+	"net/http/httptest"+	"os"+	"testing"++	"github.com/lbryio/lbrytv/app/auth"+	"github.com/lbryio/lbrytv/app/sdkrouter"+	"github.com/lbryio/lbrytv/app/wallet"+	"github.com/lbryio/lbrytv/config"+	"github.com/lbryio/lbrytv/internal/storage"+	"github.com/lbryio/lbrytv/internal/test"+	"github.com/lbryio/lbrytv/models"++	"github.com/stretchr/testify/assert"+	"github.com/stretchr/testify/require"+)++func TestMain(m *testing.M) {+	// These tests requires an environment close to production setup, i.e. no loading from the config+	config.Override("LbrynetServers", map[string]string{})+	defer config.RestoreOverridden()++	dbConfig := config.GetDatabase()+	params := storage.ConnParams{+		Connection: dbConfig.Connection,+		DBName:     dbConfig.DBName,+		Options:    dbConfig.Options,+	}+	c, connCleanup := storage.CreateTestConn(params)+	c.SetDefaultConnection()++	defer connCleanup()++	os.Exit(m.Run())

this doesn't work. os.Exit() will kill the process immediately without running any deferred functions. take a look at your postgres - i bet you have a million temp databases.

look at how i refactored the other tests that use CreateTestConn. you should do it that way

andybeletsky

comment created time in 2 months

more