Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

2203 area iteration root path should not be empty #2214

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
011023f
adding non empty path for root iteration and root area
tinakurian Aug 3, 2018
fadf8fb
fixing test
tinakurian Aug 3, 2018
3e43af1
this needs to be re-worked
tinakurian Aug 10, 2018
c07fc5d
Merge remote-tracking branch 'upstream/master' into pr/2214
kwk Aug 10, 2018
2765f51
Fix file names
kwk Aug 10, 2018
1b85d8f
fixing test
tinakurian Aug 13, 2018
b1fea80
adding non-root iteration id to path
tinakurian Aug 13, 2018
07a9a15
fix data
tinakurian Aug 13, 2018
3a6480d
fixing tests
tinakurian Aug 13, 2018
ec22c0b
fixing tests
tinakurian Aug 13, 2018
4a6eb96
fixing tests
tinakurian Aug 13, 2018
a8b903d
add comment to test
tinakurian Aug 13, 2018
8fa496e
update test files
tinakurian Aug 13, 2018
ae7a1f2
Merge branch 'master' into 2203-area-iteration-root-path-should-not-b…
tinakurian Aug 13, 2018
06799f4
removing file
tinakurian Aug 13, 2018
9741ac7
update comments
tinakurian Aug 13, 2018
54b6d97
update test comment
tinakurian Aug 13, 2018
eb3a64e
adding migration and migration tests
tinakurian Aug 14, 2018
2b2e446
adding files for migration
tinakurian Aug 14, 2018
7d36ca0
changing iterations and areas to contain current id
tinakurian Aug 14, 2018
03b2640
fixing iterations and areas
tinakurian Aug 14, 2018
d7220bd
fixing migration sql to concat with .
tinakurian Aug 14, 2018
a4aa20e
fixing test
tinakurian Aug 14, 2018
b847338
fixing broken area and iteration tests
tinakurian Aug 14, 2018
5f948f6
fixing comments
tinakurian Aug 14, 2018
ac3c8d6
removing migration 103 and merging with 102
tinakurian Aug 14, 2018
36fdb07
Merge branch 'master' of https://github.com/fabric8-services/fabric8-wit
tinakurian Aug 14, 2018
7861a70
update
tinakurian Aug 14, 2018
66446c0
merging migrations 102 and 103 into 102
tinakurian Aug 15, 2018
9efab6d
fixing .sql migration
tinakurian Aug 15, 2018
249eaed
fixing .sql
tinakurian Aug 15, 2018
6b2da43
fixing tests
tinakurian Aug 15, 2018
8e749bc
updating migration tests to include area
tinakurian Aug 16, 2018
6c7acd0
Test for root area/iteration with NULL path also
kwk Aug 16, 2018
da0bfe6
Fixup and return all child iterations of any level for a given iteration
kwk Aug 16, 2018
c721312
Fix IsRoot and Root in iteration
kwk Aug 16, 2018
2204527
Use COALESCE for index instead
kwk Aug 16, 2018
8368e9c
Fix TestCreateAreaWithSameNameFail
kwk Aug 16, 2018
982ab69
updating func test names to match convention
tinakurian Aug 16, 2018
7dba847
using case to make migration work
tinakurian Aug 20, 2018
7eb85d1
Merge branch 'master' of https://github.com/fabric8-services/fabric8-wit
tinakurian Aug 20, 2018
6f78e33
merge
tinakurian Aug 20, 2018
65d42a8
merge
tinakurian Aug 20, 2018
60935b5
Merge remote-tracking branch 'upstream/master' into 2203-area-iterati…
kwk Aug 20, 2018
d151eb6
fixup
kwk Aug 20, 2018
aa2a9b0
Merge remote-tracking branch 'tinakurian/2203-area-iteration-root-pat…
kwk Aug 20, 2018
ff42f80
Don't have empty path as root path. Use lca to circumvent invalid pos…
kwk Aug 20, 2018
2f7c739
Fixup
kwk Aug 20, 2018
9fca4a6
Fix area tests
kwk Aug 20, 2018
8e375cf
fixing test in iteration
tinakurian Aug 21, 2018
23aacb2
Merge remote-tracking branch 'upstream/master' into 2203-area-iterati…
kwk Aug 21, 2018
418f799
Fixup for merge
kwk Aug 21, 2018
48ca689
fixing remaining migration tests
tinakurian Sep 5, 2018
f8446bc
updating area test to use t instead of s.T()
tinakurian Sep 5, 2018
6058277
removing spew
tinakurian Sep 5, 2018
e5bd764
removing spew import
tinakurian Sep 5, 2018
e89c79b
Merge branch 'master' of https://github.com/fabric8-services/fabric8-wit
tinakurian Sep 5, 2018
9d5f0b2
fixing merge conflicts
tinakurian Sep 5, 2018
693f48a
adding comment requested by Konrad
tinakurian Sep 5, 2018
af57b67
updating TestParentPath
tinakurian Sep 5, 2018
e391dd5
adding a space
tinakurian Sep 5, 2018
5b22d18
using i3.MakeChildOf(*fxt.Iterations[0] as per Konrad's suggestion
tinakurian Sep 5, 2018
1269ed9
fixing tests
tinakurian Sep 5, 2018
b43e585
fixing workitem_blackbox_test
tinakurian Sep 5, 2018
92c9ca0
fixing controller tests
tinakurian Sep 6, 2018
630be3f
removing print statements
tinakurian Sep 6, 2018
13975e7
removing logmode
tinakurian Sep 6, 2018
644e007
adding setupTest() again
tinakurian Sep 6, 2018
28818f3
removing whitespace
tinakurian Sep 6, 2018
a4dd383
removing whitespace
tinakurian Sep 6, 2018
b829572
removing whitespace
tinakurian Sep 6, 2018
e6df52e
removing whitespace
tinakurian Sep 6, 2018
a3a7982
Merge branch 'master' into 2203-area-iteration-root-path-should-not-b…
tinakurian Sep 6, 2018
87d67f5
Merge branch 'master' of https://github.com/fabric8-services/fabric8-wit
tinakurian Sep 6, 2018
7af440b
fixing workitem_blackbox_test
tinakurian Sep 6, 2018
6ace752
fixing tests for space iteration
tinakurian Sep 7, 2018
5d66ffe
reset && F8_LOG_LEVEL=error F8_POSTGRES_HOST=172.17.0.2 F8_RESOURCE_D…
kwk Sep 7, 2018
151acf9
Remove path.Path.Parent() and added testfixure.GetTestFileAndFunc
kwk Sep 7, 2018
a4d0628
Small tweaks
kwk Sep 7, 2018
7c41ff9
Updated golden files
kwk Sep 7, 2018
807cffe
fixing broken iteration test
tinakurian Sep 7, 2018
eb6610f
addressing code review
tinakurian Sep 7, 2018
db972bc
fixing path
tinakurian Sep 7, 2018
921b6bf
fixing iteration test
tinakurian Sep 7, 2018
2e76cf1
Merge branch 'master' of https://github.com/fabric8-services/fabric8-wit
tinakurian Sep 10, 2018
78cabdc
Merge branch 'master' into 2203-area-iteration-root-path-should-not-b…
tinakurian Sep 10, 2018
7ea9505
adding space
tinakurian Sep 10, 2018
4928d5d
fixing parent/child iteration
tinakurian Sep 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,23 +454,6 @@ func GetMigrations() Migrations {
// Version 102
m = append(m, steps{ExecuteSQLFile("102-update-root-area-and-iteration-path-field.sql")})

// m = append(m, steps{
// func(db *sql.Tx) error {
// // update table iterations to contain converted ids in the path field
// _, err := db.Exec("UPDATE iterations SET path = text2ltree(replace(cast(id as text), '-', '_')) WHERE path = ''")
// _, err = db.Exec("UPDATE iterations SET name = 'KURIAN' WHERE id = '91111111-8333-7bbb-6000-500000000002'")
// if err != nil {
// return errs.Wrapf(err, "failed to migrate field `path` in table `iterations`")
// }
// // update table areas to contain converted ids in the path field
// _, err = db.Exec("UPDATE areas SET path = text2ltree(replace(cast(id as text), '-', '_')) WHERE path = ''")
// if err != nil {
// return errs.Wrapf(err, "failed to migrate field `path` in table `areas`")
// }
// return nil
// },
// })

// Version N
//
// In order to add an upgrade, simply append an array of MigrationFunc to the
Expand Down
45 changes: 25 additions & 20 deletions migration/migration_blackbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,27 +1183,32 @@ func testMigration99CodebaseCVEScanDefaultFalse(t *testing.T) {
// test that the userspace_data table no longer exists - previously
// used as a temporary solution to get data from tenant jenkins
func testMigration102UpdateRootIterationAreaPathField(t *testing.T) {
migrateToVersion(t, sqlDB, migrations[:102], 102)

// setup
require.Nil(t, runSQLscript(sqlDB, "102-insert-test-root-iteration.sql"))

// now see if the result is false
row := sqlDB.QueryRow("SELECT path FROM iterations WHERE id = 'abd93233-75c9-4419-a2e8-3c328736c443'")
require.NotNil(t, row)
var path string
err := row.Scan(&path)
require.NoError(t, err)
require.Equal(t, "", path)

// migrate to the current version
migrateToVersion(t, sqlDB, migrations[:103], 103)
t.Run("migrate to previous version", func(t *testing.T) {
migrateToVersion(t, sqlDB, migrations[:102], 102)
})

row = sqlDB.QueryRow("SELECT path FROM iterations WHERE id = 'abd93233-75c9-4419-a2e8-3c328736c443'")
require.NotNil(t, row)
err = row.Scan(&path)
require.NoError(t, err)
require.Equal(t, "abd93233_75c9_4419_a2e8_3c328736c443", path)
t.Run("setup", func(t *testing.T) {
require.Nil(t, runSQLscript(sqlDB, "102-insert-test-root-iteration.sql"))
})
t.Run("check that 1 iteration with empty path exists", func(t *testing.T) {
tinakurian marked this conversation as resolved.
Show resolved Hide resolved
row := sqlDB.QueryRow("SELECT path FROM iterations WHERE id = 'abd93233-75c9-4419-a2e8-3c328736c443'")
require.NotNil(t, row)
var path string
err := row.Scan(&path)
require.NoError(t, err)
require.Equal(t, "", path)
})
t.Run("migrate to current version", func(t *testing.T) {
migrateToVersion(t, sqlDB, migrations[:103], 103)
})
t.Run("check that no iteration with empty path exists", func(t *testing.T) {
tinakurian marked this conversation as resolved.
Show resolved Hide resolved
row := sqlDB.QueryRow("SELECT path FROM iterations WHERE id = 'abd93233-75c9-4419-a2e8-3c328736c443'")
require.NotNil(t, row)
var path string
err := row.Scan(&path)
require.NoError(t, err)
require.Equal(t, "abd93233_75c9_4419_a2e8_3c328736c443", path)
})
}

// runSQLscript loads the given filename from the packaged SQL test files and
Expand Down