diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-12-04 11:11:48 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-12-05 00:16:44 +0300 |
commit | 885ea5c33c8e99935e04b6f929f0bafcf3f8eed8 (patch) | |
tree | 71e7899e73be1ae1152723b80b7c43ee4c8c407e | |
parent | 6c642c087bef3b7925ca5c8cf93078b58a8efe98 (diff) |
Make subgroup specs :nested_groups
Subgroups are not supported in mySQL. I changed Namespace#root_ancestor
to return from self_and_ancestors as a bugfix.
```
184 # Returns all the ancestors of the current namespaces
185 def ancestors
186 return self.class.none unless parent_id
187
188 Gitlab::GroupHierarchy
189 .new(self.class.where(id: parent_id))
190 .base_and_ancestors
191 end
```
So it seems like on mySQL we accidentally returned the parent group :
```
ancestors = self.class.where(id: parent_id)
ancestors.reorder(nil).find_by(parent_id: nil)
```
Project#root_namespace is used only by shared_runners_limit_namespace
and all the tests for shared_runner_minutes_on_root_namespace are only
enabled on `:nested_groups`
`when :shared_runner_minutes_on_root_namespace is enabled', :nested_groups`
We very clearly state in https://docs.gitlab.com/ee/user/group/subgroups/ that `
Nested groups are only supported when you use PostgreSQL`, so I think I
will fix forward and add `:nested_groups` to the two failing feature
specs.
-rw-r--r-- | spec/features/ide_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects_spec.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/spec/features/ide_spec.rb b/spec/features/ide_spec.rb index 65989c36c1e..6eb59ef72c2 100644 --- a/spec/features/ide_spec.rb +++ b/spec/features/ide_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'IDE', :js do - describe 'sub-groups' do + describe 'sub-groups', :nested_groups do let(:user) { create(:user) } let(:group) { create(:group) } let(:subgroup) { create(:group, parent: group) } diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 0add129dde2..b56bb272b46 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -277,7 +277,7 @@ describe 'Project' do end end - context 'for subgroups', :js do + context 'for subgroups', :js, :nested_groups do let(:group) { create(:group) } let(:subgroup) { create(:group, parent: group) } let(:project) { create(:project, :repository, group: subgroup) } |