@@ -96,6 +96,37 @@ func TestBuildVersionEntry(t *testing.T) {
9696 },
9797 versionfile.VersionEntry {Edition : "mesh" , Version : "1.2.1" , Release : "1.2.x" , Latest : true , ReleaseDate : "2020-12-12" , EndOfLifeDate : "2021-12-12" , Branch : "release-1.2" },
9898 ),
99+ simpleCase (
100+ "extended adds months on top of regular lifetime" ,
101+ []github.GQLRelease {
102+ {Name : "1.2.0" , Description : "> ExtensionMonths: 6" , PublishedAt : d1 },
103+ {Name : "1.2.1" , PublishedAt : d1 .Add (time .Hour * 24 * 8 ), IsLatest : true },
104+ },
105+ versionfile.VersionEntry {Edition : "mesh" , Version : "1.2.1" , Release : "1.2.x" , Latest : true , ReleaseDate : "2020-12-12" , EndOfLifeDate : "2022-06-12" , Branch : "release-1.2" , ExtensionMonths : 6 },
106+ ),
107+ simpleCase (
108+ "extended combined with lts adds months on top of lts lifetime" ,
109+ []github.GQLRelease {
110+ {Name : "1.2.0" , Description : "> LTS\n > ExtensionMonths: 6" , PublishedAt : d1 },
111+ {Name : "1.2.1" , PublishedAt : d1 .Add (time .Hour * 48 )},
112+ },
113+ versionfile.VersionEntry {Edition : "mesh" , Version : "1.2.1" , Release : "1.2.x" , LTS : true , ReleaseDate : "2020-12-12" , EndOfLifeDate : "2023-06-12" , Branch : "release-1.2" , ExtensionMonths : 6 },
114+ ),
115+ simpleCase (
116+ "extended combined with custom release date" ,
117+ []github.GQLRelease {
118+ {Name : "1.2.0" , Description : "> Released on 2019/01/01\n > ExtensionMonths: 6" },
119+ },
120+ versionfile.VersionEntry {Edition : "mesh" , Version : "1.2.0" , Release : "1.2.x" , ReleaseDate : "2019-01-01" , EndOfLifeDate : "2020-07-01" , Branch : "release-1.2" , ExtensionMonths : 6 },
121+ ),
122+ simpleCase (
123+ "extended on non-first release is ignored" ,
124+ []github.GQLRelease {
125+ {Name : "1.2.1" , Description : "> ExtensionMonths: 6" , PublishedAt : d1 .Add (time .Hour * 48 )},
126+ {Name : "1.2.0" , Description : "foo" , PublishedAt : d1 },
127+ },
128+ versionfile.VersionEntry {Edition : "mesh" , Version : "1.2.1" , Release : "1.2.x" , ReleaseDate : "2020-12-12" , EndOfLifeDate : "2021-12-12" , Branch : "release-1.2" },
129+ ),
99130 } {
100131 t .Run (v .desc , func (t * testing.T ) {
101132 res , err := versionfile .BuildVersionEntry (v .inEdition , v .inReleaseName , v .inLifetimeMonths , v .inLtsLifetimeMonths , v .inReleases )
0 commit comments