launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30379
[Merge] ~cjwatson/launchpad:remove-snap-allow-private-feature-rule into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-snap-allow-private-feature-rule into launchpad:master.
Commit message:
Remove snap.allow_private feature rule
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/448785
It's been enabled everywhere relevant for some time.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-snap-allow-private-feature-rule into launchpad:master.
diff --git a/lib/lp/code/model/tests/test_gitrepository.py b/lib/lp/code/model/tests/test_gitrepository.py
index e7d6cbf..6f05eb7 100644
--- a/lib/lp/code/model/tests/test_gitrepository.py
+++ b/lib/lp/code/model/tests/test_gitrepository.py
@@ -176,7 +176,6 @@ from lp.services.webapp.interfaces import OAuthPermission
from lp.services.webapp.publisher import canonical_url
from lp.services.webapp.snapshot import notify_modified
from lp.services.webhooks.testing import LogsScheduledWebhooks
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import (
ANONYMOUS,
StormStatementRecorder,
@@ -3665,7 +3664,6 @@ class TestGitRepositoryMarkSnapsStale(TestCaseWithFactory):
def test_private_snap(self):
# A private snap should be able to be marked stale
self.useFixture(GitHostingFixture())
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
[ref] = self.factory.makeGitRefs()
snap = self.factory.makeSnap(git_ref=ref, private=True)
removeSecurityProxy(snap).is_stale = False
diff --git a/lib/lp/code/scripts/tests/test_request_daily_builds.py b/lib/lp/code/scripts/tests/test_request_daily_builds.py
index 9307e12..637ef17 100644
--- a/lib/lp/code/scripts/tests/test_request_daily_builds.py
+++ b/lib/lp/code/scripts/tests/test_request_daily_builds.py
@@ -19,7 +19,7 @@ from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
from lp.services.config import config
from lp.services.config.fixture import ConfigFixture, ConfigUseFixture
from lp.services.features.testing import FeatureFixture
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS, ISnap
+from lp.snappy.interfaces.snap import ISnap
from lp.soyuz.enums import ArchivePurpose
from lp.testing import TestCaseWithFactory
from lp.testing.layers import ZopelessAppServerLayer
@@ -184,9 +184,7 @@ class TestRequestDailyBuilds(TestCaseWithFactory):
def setUp(self):
super().setUp()
- features = dict(SNAP_TESTING_FLAGS)
- features[CHARM_RECIPE_ALLOW_CREATE] = "on"
- self.useFixture(FeatureFixture(features))
+ self.useFixture(FeatureFixture({CHARM_RECIPE_ALLOW_CREATE: "on"}))
def makeLoggerheadServer(self):
loggerhead_server = FakeLoggerheadServer()
diff --git a/lib/lp/code/xmlrpc/tests/test_git.py b/lib/lp/code/xmlrpc/tests/test_git.py
index e031f3f..0467947 100644
--- a/lib/lp/code/xmlrpc/tests/test_git.py
+++ b/lib/lp/code/xmlrpc/tests/test_git.py
@@ -62,7 +62,6 @@ from lp.services.macaroons.interfaces import (
from lp.services.macaroons.model import MacaroonIssuerBase
from lp.services.webapp import canonical_url
from lp.services.webapp.escaping import html_escape
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import (
ANONYMOUS,
TestCaseWithFactory,
@@ -2370,7 +2369,6 @@ class TestGitAPI(TestGitAPIMixin, TestCaseWithFactory):
def test_translatePath_private_snap_build(self):
# A builder with a suitable macaroon can read from a repository
# associated with a running private snap build.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret"
)
@@ -3284,7 +3282,6 @@ class TestGitAPI(TestGitAPIMixin, TestCaseWithFactory):
)
def test_authenticateWithPassword_private_snap_build(self):
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret"
)
@@ -3700,7 +3697,6 @@ class TestGitAPI(TestGitAPIMixin, TestCaseWithFactory):
def test_checkRefPermissions_private_snap_build(self):
# A builder with a suitable macaroon cannot write to a repository,
# even if it is associated with a running private snap build.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret"
)
diff --git a/lib/lp/codehosting/scanner/tests/test_bzrsync.py b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
index ced2631..5bb7050 100644
--- a/lib/lp/codehosting/scanner/tests/test_bzrsync.py
+++ b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
@@ -35,10 +35,8 @@ from lp.codehosting.bzrutils import read_locked, write_locked
from lp.codehosting.scanner.bzrsync import BzrSync
from lp.services.config import config
from lp.services.database.interfaces import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.osutils import override_environ
from lp.services.webhooks.testing import LogsScheduledWebhooks
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import TestCaseWithFactory
from lp.testing.dbuser import dbuser, lp_dbuser, switch_dbuser
from lp.testing.layers import LaunchpadZopelessLayer
@@ -851,7 +849,6 @@ class TestMarkSnapsStale(BzrSyncTestCase):
@run_as_db_user(config.launchpad.dbuser)
def test_mark_private_snap_stale(self):
# Private snaps should be correctly marked as stale.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
snap = self.factory.makeSnap(branch=self.db_branch, private=True)
removeSecurityProxy(snap).is_stale = False
switch_dbuser("branchscanner")
diff --git a/lib/lp/registry/browser/tests/test_pillar_sharing.py b/lib/lp/registry/browser/tests/test_pillar_sharing.py
index 6ea9fb7..43ac94e 100644
--- a/lib/lp/registry/browser/tests/test_pillar_sharing.py
+++ b/lib/lp/registry/browser/tests/test_pillar_sharing.py
@@ -28,7 +28,6 @@ from lp.services.config import config
from lp.services.features.testing import FeatureFixture
from lp.services.webapp.interfaces import StormRangeFactoryError
from lp.services.webapp.publisher import canonical_url
-from lp.snappy.interfaces.snap import SNAP_PRIVATE_FEATURE_FLAG
from lp.testing import (
StormStatementRecorder,
TestCaseWithFactory,
@@ -427,14 +426,7 @@ class PillarSharingViewTestMixin:
)
def test_pillar_person_sharing_with_team(self):
- self.useFixture(
- FeatureFixture(
- {
- SNAP_PRIVATE_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- )
- )
+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
team = self.factory.makeTeam(
membership_policy=TeamMembershipPolicy.MODERATED
)
@@ -490,14 +482,7 @@ class PillarSharingViewTestMixin:
)
def test_pillar_person_sharing(self):
- self.useFixture(
- FeatureFixture(
- {
- SNAP_PRIVATE_FEATURE_FLAG: "on",
- OCI_RECIPE_ALLOW_CREATE: "on",
- }
- )
- )
+ self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}))
person = self.factory.makePerson()
items = [
self.factory.makeOCIRecipe(
diff --git a/lib/lp/registry/services/tests/test_sharingservice.py b/lib/lp/registry/services/tests/test_sharingservice.py
index 29b1258..f0a5d13 100644
--- a/lib/lp/registry/services/tests/test_sharingservice.py
+++ b/lib/lp/registry/services/tests/test_sharingservice.py
@@ -50,7 +50,6 @@ from lp.services.job.tests import block_on_job
from lp.services.webapp.interaction import ANONYMOUS
from lp.services.webapp.interfaces import ILaunchpadRoot
from lp.services.webapp.publisher import canonical_url
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import (
StormStatementRecorder,
TestCaseWithFactory,
@@ -148,16 +147,11 @@ class TestSharingService(
def setUp(self):
super().setUp()
self.service = getUtility(IService, "sharing")
- # Set test flags and configurations for Snaps and OCI.
- flags = SNAP_TESTING_FLAGS.copy()
- flags.update(
- {
- "jobs.celery.enabled_classes": (
- "RemoveArtifactSubscriptionsJob"
- ),
+ self.setConfig(
+ feature_flags={
+ "jobs.celery.enabled_classes": "RemoveArtifactSubscriptionsJob"
}
)
- self.setConfig(feature_flags=flags)
def _makeGranteeData(
self, grantee, policy_permissions, shared_artifact_types
diff --git a/lib/lp/registry/tests/test_personmerge.py b/lib/lp/registry/tests/test_personmerge.py
index 170bfb4..5722ddd 100644
--- a/lib/lp/registry/tests/test_personmerge.py
+++ b/lib/lp/registry/tests/test_personmerge.py
@@ -49,7 +49,7 @@ from lp.services.identity.interfaces.emailaddress import (
IEmailAddressSet,
)
from lp.services.webapp.authorization import check_permission
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS, ISnapSet
+from lp.snappy.interfaces.snap import ISnapSet
from lp.soyuz.enums import ArchiveStatus
from lp.soyuz.interfaces.livefs import LIVEFS_FEATURE_FLAG, ILiveFSSet
from lp.testing import (
@@ -720,7 +720,6 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
def test_merge_snapsubscription(self):
# Checks that merging users moves subscriptions.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
duplicate = self.factory.makePerson()
mergee = self.factory.makePerson()
snap = removeSecurityProxy(
diff --git a/lib/lp/registry/tests/test_sharingjob.py b/lib/lp/registry/tests/test_sharingjob.py
index 6710772..617c7cf 100644
--- a/lib/lp/registry/tests/test_sharingjob.py
+++ b/lib/lp/registry/tests/test_sharingjob.py
@@ -41,7 +41,6 @@ from lp.services.features.testing import FeatureFixture
from lp.services.job.interfaces.job import JobStatus
from lp.services.job.tests import block_on_job
from lp.services.mail.sendmail import format_address_for_person
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import TestCaseWithFactory, login_person, person_logged_in
from lp.testing.layers import (
CeleryJobLayer,
@@ -306,7 +305,6 @@ class RemoveArtifactSubscriptionsJobTestCase(TestCaseWithFactory):
OCI_RECIPE_ALLOW_CREATE: "on",
OCI_RECIPE_PRIVATE_FEATURE_FLAG: "on",
}
- features.update(SNAP_TESTING_FLAGS)
self.useFixture(FeatureFixture(features))
super().setUp()
diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
index e331386..3599ab1 100644
--- a/lib/lp/scripts/tests/test_garbo.py
+++ b/lib/lp/scripts/tests/test_garbo.py
@@ -109,7 +109,6 @@ from lp.services.session.model import SessionData, SessionPkgData
from lp.services.verification.interfaces.authtoken import LoginTokenType
from lp.services.verification.model.logintoken import LoginToken
from lp.services.worlddata.interfaces.language import ILanguageSet
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.snappy.model.snapbuild import SnapFile
from lp.snappy.model.snapbuildjob import SnapBuildJob, SnapStoreUploadJob
from lp.soyuz.enums import (
@@ -1071,7 +1070,6 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
def test_SnapBuildJobPruner(self):
# Garbo removes jobs completed over 30 days ago.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
switch_dbuser("testadmin")
store = IPrimaryStore(Job)
@@ -1089,7 +1087,6 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
def test_SnapBuildJobPruner_doesnt_prune_recent_jobs(self):
# Garbo doesn't remove jobs under thirty days old.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
switch_dbuser("testadmin")
store = IPrimaryStore(Job)
@@ -1113,7 +1110,6 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
def test_SnapBuildJobPruner_doesnt_prune_most_recent_job_for_build(self):
# Garbo doesn't remove the most recent job for a build.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
switch_dbuser("testadmin")
store = IPrimaryStore(Job)
diff --git a/lib/lp/snappy/browser/hassnaps.py b/lib/lp/snappy/browser/hassnaps.py
index 7a2ee77..7e4b5a4 100644
--- a/lib/lp/snappy/browser/hassnaps.py
+++ b/lib/lp/snappy/browser/hassnaps.py
@@ -12,10 +12,9 @@ from zope.component import getUtility
from lp.code.browser.decorations import DecoratedBranch
from lp.code.interfaces.gitrepository import IGitRepository
-from lp.services.features import getFeatureFlag
from lp.services.webapp import Link, canonical_url
from lp.services.webapp.escaping import structured
-from lp.snappy.interfaces.snap import SNAP_PRIVATE_FEATURE_FLAG, ISnapSet
+from lp.snappy.interfaces.snap import ISnapSet
class HasSnapsMenuMixin:
@@ -34,14 +33,7 @@ class HasSnapsMenuMixin:
return Link("+snaps", text, icon="info", enabled=enabled)
def create_snap(self):
- # Only enabled if the snap_private flag is enabled for
- # private contexts.
- enabled = not self.context.private or bool(
- getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG)
- )
-
- text = "Create snap package"
- return Link("+new-snap", text, enabled=enabled, icon="add")
+ return Link("+new-snap", "Create snap package", icon="add")
class HasSnapsViewMixin:
diff --git a/lib/lp/snappy/browser/snap.py b/lib/lp/snappy/browser/snap.py
index 5a74635..96097fb 100644
--- a/lib/lp/snappy/browser/snap.py
+++ b/lib/lp/snappy/browser/snap.py
@@ -36,7 +36,6 @@ from lp.app.browser.launchpadform import (
from lp.app.browser.lazrjs import InlinePersonEditPickerWidget
from lp.app.browser.tales import format_link
from lp.app.enums import PRIVATE_INFORMATION_TYPES
-from lp.app.interfaces.informationtype import IInformationType
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.app.vocabularies import InformationTypeVocabulary
from lp.app.widgets.itemswidgets import (
@@ -77,7 +76,6 @@ from lp.services.webhooks.browser import WebhookTargetNavigationMixin
from lp.snappy.browser.widgets.snaparchive import SnapArchiveWidget
from lp.snappy.browser.widgets.storechannels import StoreChannelsWidget
from lp.snappy.interfaces.snap import (
- SNAP_PRIVATE_FEATURE_FLAG,
SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG,
CannotAuthorizeStoreUploads,
CannotFetchSnapcraftYaml,
@@ -86,7 +84,6 @@ from lp.snappy.interfaces.snap import (
ISnapSet,
MissingSnapcraftYaml,
NoSuchSnap,
- SnapPrivateFeatureDisabled,
)
from lp.snappy.interfaces.snapbuild import ISnapBuild, ISnapBuildSet
from lp.snappy.interfaces.snappyseries import (
@@ -621,19 +618,6 @@ class SnapAddView(
"store_channels",
]
- def initialize(self):
- """See `LaunchpadView`."""
- super().initialize()
-
- # Once initialized, if the private_snap flag is disabled, it
- # prevents snap creation for private contexts.
- if not getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG):
- if (
- IInformationType.providedBy(self.context)
- and self.context.information_type in PRIVATE_INFORMATION_TYPES
- ):
- raise SnapPrivateFeatureDisabled
-
@property
def is_project_context(self):
return IProduct.providedBy(self.context)
diff --git a/lib/lp/snappy/browser/tests/test_snap.py b/lib/lp/snappy/browser/tests/test_snap.py
index 1efc57d..f5535cc 100644
--- a/lib/lp/snappy/browser/tests/test_snap.py
+++ b/lib/lp/snappy/browser/tests/test_snap.py
@@ -60,13 +60,10 @@ from lp.snappy.browser.snap import (
SnapView,
)
from lp.snappy.interfaces.snap import (
- SNAP_PRIVATE_FEATURE_FLAG,
SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG,
- SNAP_TESTING_FLAGS,
CannotModifySnapProcessor,
ISnapSet,
SnapBuildRequestStatus,
- SnapPrivateFeatureDisabled,
)
from lp.snappy.interfaces.snappyseries import ISnappyDistroSeriesSet
from lp.snappy.interfaces.snapstoreclient import ISnapStoreClient
@@ -99,10 +96,6 @@ from lp.testing.views import create_initialized_view, create_view
class TestSnapNavigation(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_canonical_url(self):
owner = self.factory.makePerson(name="person")
snap = self.factory.makeSnap(
@@ -120,32 +113,11 @@ class TestSnapNavigation(TestCaseWithFactory):
self.assertEqual(snap, obj)
-class TestSnapViewsFeatureFlag(TestCaseWithFactory):
- layer = DatabaseFunctionalLayer
-
- def test_private_feature_flag_disabled(self):
- # Without a private_snap feature flag, we will not create Snaps for
- # private contexts.
- self.useFixture(BranchHostingFixture())
- owner = self.factory.makePerson()
- branch = self.factory.makeAnyBranch(
- owner=owner, information_type=InformationType.USERDATA
- )
- with person_logged_in(owner):
- self.assertRaises(
- SnapPrivateFeatureDisabled,
- create_initialized_view,
- branch,
- "+new-snap",
- )
-
-
class BaseTestSnapView(BrowserTestCase):
layer = LaunchpadFunctionalLayer
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.useFixture(FakeLogger())
self.snap_store_client = FakeMethod()
self.snap_store_client.requestPackageUploadPermission = getUtility(
@@ -440,21 +412,13 @@ class TestSnapAddView(BaseTestSnapView):
)
def test_create_new_snap_private_link(self):
- # Link for create new snaps for private content is only displayed
- # if the 'snap.allow_private' is enabled.
+ # A link to create new snaps is displayed even for private content.
login_person(self.person)
branch = self.factory.makeAnyBranch(
owner=self.person, information_type=InformationType.USERDATA
)
-
- with FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: ""}):
- browser = self.getViewBrowser(branch, user=self.person)
- self.assertRaises(
- LinkNotFoundError, browser.getLink, "Create snap package"
- )
- with FeatureFixture(SNAP_TESTING_FLAGS):
- browser = self.getViewBrowser(branch, user=self.person)
- browser.getLink("Create snap package")
+ browser = self.getViewBrowser(branch, user=self.person)
+ browser.getLink("Create snap package")
def test_create_new_snap_private(self):
# Creates a private snap for a private project.
@@ -487,7 +451,7 @@ class TestSnapAddView(BaseTestSnapView):
self.assertEqual(InformationType.PROPRIETARY, snap.information_type)
def test_create_new_snap_private_without_project_fails(self):
- # It should not not be possible to create a private snap with
+ # It should not be possible to create a private snap with
# information_type not matching project's branch_sharing_policy.
login_person(self.person)
[git_ref] = self.factory.makeGitRefs()
diff --git a/lib/lp/snappy/browser/tests/test_snaplisting.py b/lib/lp/snappy/browser/tests/test_snaplisting.py
index 90ffea1..e2092a7 100644
--- a/lib/lp/snappy/browser/tests/test_snaplisting.py
+++ b/lib/lp/snappy/browser/tests/test_snaplisting.py
@@ -12,9 +12,7 @@ from zope.security.proxy import removeSecurityProxy
from lp.code.tests.helpers import GitHostingFixture
from lp.services.database.constants import ONE_DAY_AGO, SEVEN_DAYS_AGO, UTC_NOW
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp import canonical_url
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import (
ANONYMOUS,
BrowserTestCase,
@@ -178,7 +176,6 @@ class TestSnapListing(BrowserTestCase):
def test_project_private_snap_listing(self):
# Only users with permission can see private snap packages in the list
# for a project.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
project = self.factory.makeProduct(displayname="Snappable")
private_owner = self.factory.makePerson()
user_with_permission = self.factory.makePerson()
@@ -226,7 +223,6 @@ class TestSnapListing(BrowserTestCase):
)
def test_person_private_snap_listing(self):
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
private_owner = self.factory.makePerson(name="random-user")
user_with_permission = self.factory.makePerson()
someone_else = self.factory.makePerson()
@@ -283,7 +279,6 @@ class TestSnapListing(BrowserTestCase):
def test_branch_private_snap_listing(self):
# Only certain users can see private snaps on branch listing.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
private_owner = self.factory.makePerson(name="random-user")
user_with_permission = self.factory.makePerson()
someone_else = self.factory.makePerson()
@@ -330,7 +325,6 @@ class TestSnapListing(BrowserTestCase):
def test_git_repository_private_snap_listing(self):
# Only certain users can see private snaps on git repo listing.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
private_owner = self.factory.makePerson(name="random-user")
user_with_permission = self.factory.makePerson()
someone_else = self.factory.makePerson()
@@ -381,7 +375,6 @@ class TestSnapListing(BrowserTestCase):
def test_git_ref_private_snap_listing(self):
# Only certain users can see private snaps on git ref listing.
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
private_owner = self.factory.makePerson(name="random-user")
user_with_permission = self.factory.makePerson()
someone_else = self.factory.makePerson()
diff --git a/lib/lp/snappy/browser/tests/test_snapsubscription.py b/lib/lp/snappy/browser/tests/test_snapsubscription.py
index eb960c4..6de1165 100644
--- a/lib/lp/snappy/browser/tests/test_snapsubscription.py
+++ b/lib/lp/snappy/browser/tests/test_snapsubscription.py
@@ -8,9 +8,7 @@ from zope.security.interfaces import Unauthorized
from lp.app.enums import InformationType
from lp.registry.enums import BranchSharingPolicy
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp import canonical_url
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.testing import BrowserTestCase, admin_logged_in, person_logged_in
from lp.testing.layers import DatabaseFunctionalLayer
from lp.testing.pages import (
@@ -26,7 +24,6 @@ class BaseTestSnapView(BrowserTestCase):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.useFixture(FakeLogger())
self.person = self.factory.makePerson(name="snap-owner")
diff --git a/lib/lp/snappy/interfaces/snap.py b/lib/lp/snappy/interfaces/snap.py
index 58a0148..56f40d0 100644
--- a/lib/lp/snappy/interfaces/snap.py
+++ b/lib/lp/snappy/interfaces/snap.py
@@ -22,9 +22,7 @@ __all__ = [
"MissingSnapcraftYaml",
"NoSourceForSnap",
"NoSuchSnap",
- "SNAP_PRIVATE_FEATURE_FLAG",
"SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG",
- "SNAP_TESTING_FLAGS",
"SnapAuthorizationBadGeneratedMacaroon",
"SnapBuildAlreadyPending",
"SnapBuildArchiveOwnerMismatch",
@@ -33,7 +31,6 @@ __all__ = [
"SnapNotOwner",
"SnapPrivacyMismatch",
"SnapPrivacyPillarError",
- "SnapPrivateFeatureDisabled",
]
import http.client
@@ -103,15 +100,9 @@ from lp.snappy.validators.channels import channels_validator
from lp.soyuz.interfaces.archive import IArchive
from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
-SNAP_PRIVATE_FEATURE_FLAG = "snap.allow_private"
SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG = "snap.channels.snapcraft"
-SNAP_TESTING_FLAGS = {
- SNAP_PRIVATE_FEATURE_FLAG: "on",
-}
-
-
@error_status(http.client.BAD_REQUEST)
class SnapBuildAlreadyPending(Exception):
"""A build was requested when an identical build was already pending."""
@@ -152,14 +143,6 @@ class SnapBuildDisallowedArchitecture(Exception):
)
-@error_status(http.client.UNAUTHORIZED)
-class SnapPrivateFeatureDisabled(Unauthorized):
- """Only certain users can create private snap objects."""
-
- def __init__(self):
- super().__init__("You do not have permission to create private snaps")
-
-
@error_status(http.client.BAD_REQUEST)
class DuplicateSnapName(Exception):
"""Raised for snap packages with duplicate name/owner."""
diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
index 6572d17..7eb85f9 100644
--- a/lib/lp/snappy/model/snap.py
+++ b/lib/lp/snappy/model/snap.py
@@ -123,7 +123,6 @@ from lp.services.database.stormexpr import (
IsDistinctFrom,
NullsLast,
)
-from lp.services.features import getFeatureFlag
from lp.services.job.interfaces.job import JobStatus
from lp.services.job.model.job import Job
from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
@@ -136,7 +135,6 @@ from lp.services.webhooks.interfaces import IWebhookSet
from lp.services.webhooks.model import WebhookTargetMixin
from lp.snappy.adapters.buildarch import determine_architectures_to_build
from lp.snappy.interfaces.snap import (
- SNAP_PRIVATE_FEATURE_FLAG,
BadMacaroon,
BadSnapSearchContext,
BadSnapSource,
@@ -159,7 +157,6 @@ from lp.snappy.interfaces.snap import (
SnapBuildRequestStatus,
SnapNotOwner,
SnapPrivacyMismatch,
- SnapPrivateFeatureDisabled,
)
from lp.snappy.interfaces.snapbase import ISnapBaseSet, NoSuchSnapBase
from lp.snappy.interfaces.snapbuild import ISnapBuild, ISnapBuildSet
@@ -1621,9 +1618,6 @@ class SnapSet:
):
private = information_type not in PUBLIC_INFORMATION_TYPES
if private:
- # If appropriately enabled via feature flag.
- if not getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG):
- raise SnapPrivateFeatureDisabled
return True
# Public snaps with private sources are not allowed.
diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py
index a754b03..253a91d 100644
--- a/lib/lp/snappy/tests/test_snap.py
+++ b/lib/lp/snappy/tests/test_snap.py
@@ -68,7 +68,7 @@ from lp.services.database.sqlbase import (
flush_database_caches,
get_transaction_timestamp,
)
-from lp.services.features.testing import FeatureFixture, MemoryFeatureFixture
+from lp.services.features.testing import MemoryFeatureFixture
from lp.services.job.interfaces.job import JobStatus
from lp.services.job.runner import JobRunner
from lp.services.log.logger import BufferLogger
@@ -79,7 +79,6 @@ from lp.services.webapp.publisher import canonical_url
from lp.services.webapp.snapshot import notify_modified
from lp.services.webhooks.testing import LogsScheduledWebhooks
from lp.snappy.interfaces.snap import (
- SNAP_TESTING_FLAGS,
BadSnapSearchContext,
CannotFetchSnapcraftYaml,
CannotModifySnapProcessor,
@@ -92,7 +91,6 @@ from lp.snappy.interfaces.snap import (
SnapBuildDisallowedArchitecture,
SnapBuildRequestStatus,
SnapPrivacyMismatch,
- SnapPrivateFeatureDisabled,
)
from lp.snappy.interfaces.snapbase import ISnapBaseSet, NoSuchSnapBase
from lp.snappy.interfaces.snapbuild import (
@@ -127,40 +125,14 @@ from lp.testing import (
from lp.testing.dbuser import dbuser
from lp.testing.fakemethod import FakeMethod
from lp.testing.fixture import ZopeUtilityFixture
-from lp.testing.layers import (
- DatabaseFunctionalLayer,
- LaunchpadFunctionalLayer,
- LaunchpadZopelessLayer,
-)
+from lp.testing.layers import DatabaseFunctionalLayer, LaunchpadFunctionalLayer
from lp.testing.matchers import DoesNotSnapshot, HasQueryCount
from lp.testing.pages import webservice_for_person
-class TestSnapFeatureFlag(TestCaseWithFactory):
- layer = LaunchpadZopelessLayer
-
- def test_private_feature_flag_disabled(self):
- # Without a private feature flag, we will not create new private Snaps.
- person = self.factory.makePerson()
- self.assertRaises(
- SnapPrivateFeatureDisabled,
- getUtility(ISnapSet).new,
- person,
- person,
- None,
- None,
- branch=self.factory.makeAnyBranch(),
- information_type=InformationType.PROPRIETARY,
- )
-
-
class TestSnapPermissions(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_delete_permissions_registry_experts(self):
# A snap package can be deleted from registry_experts,
# commercial_admin, admin and owner.
@@ -263,10 +235,6 @@ class TestSnapPermissions(TestCaseWithFactory):
class TestSnap(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_implements_interfaces(self):
# Snap implements ISnap.
snap = self.factory.makeSnap()
@@ -1957,10 +1925,6 @@ class TestSnap(TestCaseWithFactory):
class TestSnapDeleteWithBuilds(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_delete_with_builds(self):
# A snap package with builds can be deleted. Doing so deletes all
# its builds, their files, and any associated build jobs too.
@@ -2101,10 +2065,6 @@ class TestSnapDeleteWithBuilds(TestCaseWithFactory):
class TestSnapVisibility(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def getSnapGrants(self, snap, person=None):
conditions = [AccessArtifact.snap == snap]
if person is not None:
@@ -2270,10 +2230,6 @@ class TestSnapVisibility(TestCaseWithFactory):
class TestSnapSet(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_class_implements_interfaces(self):
# The SnapSet class implements ISnapSet.
self.assertProvides(getUtility(ISnapSet), ISnapSet)
@@ -3502,7 +3458,6 @@ class TestSnapProcessors(TestCaseWithFactory):
def setUp(self):
super().setUp(user="foo.bar@xxxxxxxxxxxxx")
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.default_procs = [
getUtility(IProcessorSet).getByName("386"),
getUtility(IProcessorSet).getByName("amd64"),
@@ -3652,7 +3607,6 @@ class TestSnapWebservice(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.snap_store_client = FakeMethod()
self.snap_store_client.requestPackageUploadPermission = getUtility(
ISnapStoreClient
diff --git a/lib/lp/snappy/tests/test_snapbuild.py b/lib/lp/snappy/tests/test_snapbuild.py
index 36c1481..678d6e9 100644
--- a/lib/lp/snappy/tests/test_snapbuild.py
+++ b/lib/lp/snappy/tests/test_snapbuild.py
@@ -32,7 +32,6 @@ from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.interfaces.series import SeriesStatus
from lp.services.authserver.xmlrpc import AuthServerAPIView
from lp.services.config import config
-from lp.services.features.testing import FeatureFixture
from lp.services.job.interfaces.job import JobStatus
from lp.services.librarian.browser import ProxiedLibraryFileAlias
from lp.services.macaroons.interfaces import IMacaroonIssuer
@@ -41,7 +40,6 @@ from lp.services.propertycache import clear_property_cache
from lp.services.webapp.interfaces import OAuthPermission
from lp.services.webapp.publisher import canonical_url
from lp.services.webhooks.testing import LogsScheduledWebhooks
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.snappy.interfaces.snapbuild import (
CannotScheduleStoreUpload,
ISnapBuild,
@@ -85,7 +83,6 @@ class TestSnapBuild(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"snappy",
store_url="http://sca.example/",
@@ -804,10 +801,6 @@ class TestSnapBuild(TestCaseWithFactory):
class TestSnapBuildSet(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_getByBuildFarmJob_works(self):
build = self.factory.makeSnapBuild()
self.assertEqual(
@@ -841,7 +834,6 @@ class TestSnapBuildWebservice(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.person = self.factory.makePerson()
self.webservice = webservice_for_person(
self.person, permission=OAuthPermission.WRITE_PRIVATE
@@ -1025,7 +1017,6 @@ class TestSnapBuildMacaroonIssuer(MacaroonTestMixin, TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret"
)
diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
index 8050ecd..1f5aeb6 100644
--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
@@ -71,7 +71,6 @@ from lp.services.macaroons.testing import MacaroonVerifies
from lp.services.statsd.tests import StatsMixin
from lp.services.webapp import canonical_url
from lp.snappy.interfaces.snap import (
- SNAP_PRIVATE_FEATURE_FLAG,
SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG,
SnapBuildArchiveOwnerMismatch,
)
@@ -517,7 +516,6 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
def test_extraBuildArgs_git_private(self):
# extraBuildArgs returns appropriate arguments if asked to build a
# job for a private Git branch.
- self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: "on"}))
self.useFixture(InProcessAuthServerFixture())
self.pushConfig(
"launchpad", internal_macaroon_secret_key="some-secret"
@@ -1137,7 +1135,6 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
def test_extraBuildArgs_private(self):
# If the snap is private, extraBuildArgs sends the appropriate
# arguments.
- self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: "on"}))
job = self.makeJob(private=True)
with dbuser(config.builddmaster.dbuser):
args = yield job.extraBuildArgs()
diff --git a/lib/lp/snappy/tests/test_snapbuildjob.py b/lib/lp/snappy/tests/test_snapbuildjob.py
index baf457a..7e69f3c 100644
--- a/lib/lp/snappy/tests/test_snapbuildjob.py
+++ b/lib/lp/snappy/tests/test_snapbuildjob.py
@@ -20,12 +20,10 @@ from zope.security.proxy import removeSecurityProxy
from lp.buildmaster.enums import BuildStatus
from lp.services.config import config
from lp.services.database.interfaces import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.job.interfaces.job import JobStatus
from lp.services.job.runner import JobRunner
from lp.services.webapp.publisher import canonical_url
from lp.services.webhooks.testing import LogsScheduledWebhooks
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.snappy.interfaces.snapbuildjob import (
ISnapBuildJob,
ISnapStoreUploadJob,
@@ -92,10 +90,6 @@ class FileUploaded(MatchesListwise):
class TestSnapBuildJob(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_provides_interface(self):
# `SnapBuildJob` objects provide `ISnapBuildJob`.
snapbuild = self.factory.makeSnapBuild()
@@ -110,7 +104,6 @@ class TestSnapStoreUploadJob(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.status_url = "http://sca.example/dev/api/snaps/1/builds/1/status"
self.store_url = "http://sca.example/dev/click-apps/1/rev/1/"
diff --git a/lib/lp/snappy/tests/test_snappyseries.py b/lib/lp/snappy/tests/test_snappyseries.py
index bae6eb4..4d159f8 100644
--- a/lib/lp/snappy/tests/test_snappyseries.py
+++ b/lib/lp/snappy/tests/test_snappyseries.py
@@ -8,9 +8,7 @@ from zope.component import getAdapter, getUtility
from lp.app.interfaces.security import IAuthorization
from lp.services.database.interfaces import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.interfaces import OAuthPermission
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.snappy.interfaces.snappyseries import (
ISnappyDistroSeriesSet,
ISnappySeries,
@@ -32,10 +30,6 @@ from lp.testing.pages import webservice_for_person
class TestSnappySeries(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_implements_interface(self):
# SnappySeries implements ISnappySeries.
snappy_series = self.factory.makeSnappySeries()
@@ -98,10 +92,6 @@ class TestSnappySeries(TestCaseWithFactory):
class TestSnappySeriesSet(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_getByName(self):
snappy_series = self.factory.makeSnappySeries(name="foo")
self.factory.makeSnappySeries()
@@ -123,10 +113,6 @@ class TestSnappySeriesSet(TestCaseWithFactory):
class TestSnappySeriesWebservice(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_new_unpriv(self):
# An unprivileged user cannot create a SnappySeries.
person = self.factory.makePerson()
@@ -253,10 +239,6 @@ class TestSnappySeriesWebservice(TestCaseWithFactory):
class TestSnappyDistroSeriesSet(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
- def setUp(self):
- super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
-
def test_getByBothSeries(self):
dses = [self.factory.makeDistroSeries() for _ in range(2)]
snappy_serieses = [self.factory.makeSnappySeries() for _ in range(2)]
diff --git a/lib/lp/snappy/tests/test_snapstoreclient.py b/lib/lp/snappy/tests/test_snapstoreclient.py
index e1516f2..86dbc4a 100644
--- a/lib/lp/snappy/tests/test_snapstoreclient.py
+++ b/lib/lp/snappy/tests/test_snapstoreclient.py
@@ -33,11 +33,9 @@ from zope.security.proxy import removeSecurityProxy
from lp.buildmaster.enums import BuildStatus
from lp.services.config import config
from lp.services.crypto.interfaces import IEncryptedContainer
-from lp.services.features.testing import FeatureFixture
from lp.services.log.logger import BufferLogger
from lp.services.memcache.interfaces import IMemcacheClient
from lp.services.timeline.requesttimeline import get_request_timeline
-from lp.snappy.interfaces.snap import SNAP_TESTING_FLAGS
from lp.snappy.interfaces.snapstoreclient import (
BadRequestPackageUploadResponse,
BadScanStatusResponse,
@@ -254,7 +252,6 @@ class TestSnapStoreClient(TestCaseWithFactory):
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS))
self.pushConfig(
"snappy",
store_url="http://sca.example/",