diff --git a/api/ceramic_cache/test/test_db_data_model.py b/api/ceramic_cache/test/test_db_data_model.py index 7c4bcaddc..f7ba0a4f7 100644 --- a/api/ceramic_cache/test/test_db_data_model.py +++ b/api/ceramic_cache/test/test_db_data_model.py @@ -28,26 +28,26 @@ }, } -# TODO: enable this after uniqueness can be enforced -# class TestGetStamps: -# @pytest.mark.django_db -# def test_no_duplicate_stamps(self): -# """Make sure that it is not possible to have duplicate stamps in the DB""" -# address = "0x123test" +class TestGetStamps: + @pytest.mark.django_db + def test_no_duplicate_stamps(self): + """Make sure that it is not possible to have duplicate stamps in the DB""" -# # Create the first stamp -# CeramicCache.objects.create( -# address=address, -# provider=stamp["credentialSubject"]["provider"], -# stamp=stamp, -# ) + address = "0x123test" -# with pytest.raises(IntegrityError) as exc_info: -# # Create the same stamp (same provider) again -# # We expect an exception to be thrown -# CeramicCache.objects.create( -# address=address, -# provider=stamp["credentialSubject"]["provider"], -# stamp=stamp, -# ) + # Create the first stamp + CeramicCache.objects.create( + address=address, + provider_clone=stamp["credentialSubject"]["provider"], + stamp=stamp, + ) + + with pytest.raises(IntegrityError) as exc_info: + # Create the same stamp (same provider) again + # We expect an exception to be thrown + CeramicCache.objects.create( + address=address, + provider_clone=stamp["credentialSubject"]["provider"], + stamp=stamp, + ) diff --git a/infra/prod/index.ts b/infra/prod/index.ts index 15aa58a03..cabe7c43c 100644 --- a/infra/prod/index.ts +++ b/infra/prod/index.ts @@ -1010,10 +1010,10 @@ const redashInitScript = redashDbUrl.apply((url) => echo "Try to pull from git repo or clone the repo if it was not cloned before ..." git pull /passport-redash || git clone https://github.com/gitcoinco/passport-redash.git /passport-redash - + echo "Changing directory and setting permissions..." cd /passport-redash - + chmod +x ./setup.sh ./setup.sh @@ -1360,10 +1360,7 @@ buildHttpLambdaFn({ name: "cc-auhenticate", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.authenticate_POST.handler"], - pathPatterns: [ - "/ceramic-cache/authenticate", - "/ceramic-cache/v2/authenticate", - ], + pathPatterns: ["/ceramic-cache/authenticate"], httpRequestMethods: ["POST"], listenerPriority: 1005, }); @@ -1373,7 +1370,7 @@ buildHttpLambdaFn({ name: "cc-v1-score-POST", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.score_POST.handler"], - pathPatterns: ["/ceramic-cache/score/*", "/ceramic-cache/v2/score/*"], + pathPatterns: ["/ceramic-cache/score/*"], httpRequestMethods: ["POST"], listenerPriority: 1006, }); @@ -1383,7 +1380,7 @@ buildHttpLambdaFn({ name: "cc-v1-score-GET", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.score_GET.handler"], - pathPatterns: ["/ceramic-cache/score/*", "/ceramic-cache/v2/score/*"], + pathPatterns: ["/ceramic-cache/score/*"], httpRequestMethods: ["GET"], listenerPriority: 1007, }); @@ -1393,7 +1390,7 @@ buildHttpLambdaFn({ name: "cc-weights-GET", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.weights_GET.handler"], - pathPatterns: ["/ceramic-cache/weights", "/ceramic-cache/v2/weights"], + pathPatterns: ["/ceramic-cache/weights"], httpRequestMethods: ["GET"], listenerPriority: 1015, }); @@ -1408,46 +1405,6 @@ buildHttpLambdaFn({ listenerPriority: 1010, }); -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-POST", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_POST.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["POST"], - listenerPriority: 1011, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-PATCH", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_PATCH.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["PATCH"], - listenerPriority: 1012, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-DELETE", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_DELETE.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["DELETE"], - listenerPriority: 1013, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-GET", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamp_GET.handler"], - pathPatterns: ["/ceramic-cache/v2/stamp"], - httpRequestMethods: ["GET"], - listenerPriority: 1014, -}); - buildQueueLambdaFn({ ...lambdaSettings, name: "rescore", diff --git a/infra/staging/index.ts b/infra/staging/index.ts index 12ce2c7e2..e24e2b8bb 100644 --- a/infra/staging/index.ts +++ b/infra/staging/index.ts @@ -669,10 +669,7 @@ buildHttpLambdaFn({ name: "cc-auhenticate", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.authenticate_POST.handler"], - pathPatterns: [ - "/ceramic-cache/authenticate", - "/ceramic-cache/v2/authenticate", - ], + pathPatterns: ["/ceramic-cache/authenticate"], httpRequestMethods: ["POST"], listenerPriority: 2005, }); @@ -682,7 +679,7 @@ buildHttpLambdaFn({ name: "cc-v1-score-POST", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.score_POST.handler"], - pathPatterns: ["/ceramic-cache/score/*", "/ceramic-cache/v2/score/*"], + pathPatterns: ["/ceramic-cache/score/*"], httpRequestMethods: ["POST"], listenerPriority: 2006, }); @@ -692,7 +689,7 @@ buildHttpLambdaFn({ name: "cc-v1-score-GET", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.score_GET.handler"], - pathPatterns: ["/ceramic-cache/score/*", "/ceramic-cache/v2/score/*"], + pathPatterns: ["/ceramic-cache/score/*"], httpRequestMethods: ["GET"], listenerPriority: 2007, }); @@ -702,7 +699,7 @@ buildHttpLambdaFn({ name: "cc-weights-GET", memorySize: 512, dockerCmd: ["aws_lambdas.scorer_api_passport.v1.weights_GET.handler"], - pathPatterns: ["/ceramic-cache/weights", "/ceramic-cache/v2/weights"], + pathPatterns: ["/ceramic-cache/weights"], httpRequestMethods: ["GET"], listenerPriority: 2015, }); @@ -717,46 +714,6 @@ buildHttpLambdaFn({ listenerPriority: 2010, }); -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-POST", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_POST.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["POST"], - listenerPriority: 2011, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-PATCH", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_PATCH.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["PATCH"], - listenerPriority: 2012, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-bulk-DELETE", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamps.bulk_DELETE.handler"], - pathPatterns: ["/ceramic-cache/v2/stamps/bulk"], - httpRequestMethods: ["DELETE"], - listenerPriority: 2013, -}); - -buildHttpLambdaFn({ - ...lambdaSettings, - name: "cc-v2-st-GET", - memorySize: 512, - dockerCmd: ["aws_lambdas.scorer_api_passport.v2.stamp_GET.handler"], - pathPatterns: ["/ceramic-cache/v2/stamp"], - httpRequestMethods: ["GET"], - listenerPriority: 2014, -}); - buildQueueLambdaFn({ ...lambdaSettings, name: "rescore", @@ -1027,10 +984,10 @@ const redashInitScript = redashDbUrl.apply((url) => echo "Try to pull from git repo or clone the repo if it was not cloned before ..." git pull /passport-redash || git clone https://github.com/gitcoinco/passport-redash.git /passport-redash - + echo "Changing directory and setting permissions..." cd /passport-redash - + chmod +x ./setup.sh ./setup.sh