(t *testing.T)
| 898 | } |
| 899 | |
| 900 | func TestTemplateTTL(t *testing.T) { |
| 901 | t.Parallel() |
| 902 | |
| 903 | tests := []struct { |
| 904 | name string |
| 905 | allowUserAutostop bool |
| 906 | fromTTL time.Duration |
| 907 | toTTL time.Duration |
| 908 | expected sql.NullInt64 |
| 909 | }{ |
| 910 | { |
| 911 | name: "AllowUserAutostopFalse/ModifyTTLDurationDown", |
| 912 | allowUserAutostop: false, |
| 913 | fromTTL: 24 * time.Hour, |
| 914 | toTTL: 1 * time.Hour, |
| 915 | expected: sql.NullInt64{Valid: true, Int64: int64(1 * time.Hour)}, |
| 916 | }, |
| 917 | { |
| 918 | name: "AllowUserAutostopFalse/ModifyTTLDurationUp", |
| 919 | allowUserAutostop: false, |
| 920 | fromTTL: 24 * time.Hour, |
| 921 | toTTL: 36 * time.Hour, |
| 922 | expected: sql.NullInt64{Valid: true, Int64: int64(36 * time.Hour)}, |
| 923 | }, |
| 924 | { |
| 925 | name: "AllowUserAutostopFalse/ModifyTTLDurationSame", |
| 926 | allowUserAutostop: false, |
| 927 | fromTTL: 24 * time.Hour, |
| 928 | toTTL: 24 * time.Hour, |
| 929 | expected: sql.NullInt64{Valid: true, Int64: int64(24 * time.Hour)}, |
| 930 | }, |
| 931 | { |
| 932 | name: "AllowUserAutostopFalse/DisableTTL", |
| 933 | allowUserAutostop: false, |
| 934 | fromTTL: 24 * time.Hour, |
| 935 | toTTL: 0, |
| 936 | expected: sql.NullInt64{}, |
| 937 | }, |
| 938 | { |
| 939 | name: "AllowUserAutostopTrue/ModifyTTLDurationDown", |
| 940 | allowUserAutostop: true, |
| 941 | fromTTL: 24 * time.Hour, |
| 942 | toTTL: 1 * time.Hour, |
| 943 | expected: sql.NullInt64{Valid: true, Int64: int64(24 * time.Hour)}, |
| 944 | }, |
| 945 | { |
| 946 | name: "AllowUserAutostopTrue/ModifyTTLDurationUp", |
| 947 | allowUserAutostop: true, |
| 948 | fromTTL: 24 * time.Hour, |
| 949 | toTTL: 36 * time.Hour, |
| 950 | expected: sql.NullInt64{Valid: true, Int64: int64(24 * time.Hour)}, |
| 951 | }, |
| 952 | { |
| 953 | name: "AllowUserAutostopTrue/ModifyTTLDurationSame", |
| 954 | allowUserAutostop: true, |
| 955 | fromTTL: 24 * time.Hour, |
| 956 | toTTL: 24 * time.Hour, |
| 957 | expected: sql.NullInt64{Valid: true, Int64: int64(24 * time.Hour)}, |
nothing calls this directly
no test coverage detected