@@ -1501,74 +1501,6 @@ func testRegistryOrImageRequired(cmdFn commandConstructor, t *testing.T) {
15011501 }
15021502}
15031503
1504- // TestDeploy_Authentication ensures that Token and Username/Password auth
1505- // propagate their values to pushers which support them.
1506- func TestDeploy_Authentication (t * testing.T ) {
1507- testAuthentication (NewDeployCmd , t )
1508- }
1509-
1510- func testAuthentication (cmdFn commandConstructor , t * testing.T ) {
1511- // This test is currently focused on ensuring the flags for
1512- // explicit credentials (bearer token and username/password) are respected
1513- // and propagated to pushers which support this authentication method.
1514- // Integration tests must be used to ensure correct integration between
1515- // the system and credential helpers (Docker, ecs, acs)
1516- t .Helper ()
1517-
1518- root := FromTempDirectory (t )
1519- _ , err := fn .New ().Init (fn.Function {Runtime : "go" , Root : root , Registry : TestRegistry })
1520- if err != nil {
1521- t .Fatal (err )
1522- }
1523-
1524- var (
1525- testUser = "alice"
1526- testPass = "123"
1527- testToken = "example.jwt.token"
1528- )
1529-
1530- // Basic Auth: username/password
1531- // -----------------------------
1532- pusher := mock .NewPusher ()
1533- pusher .PushFn = func (ctx context.Context , _ fn.Function ) (string , error ) {
1534- username , _ := ctx .Value (fn.PushUsernameKey {}).(string )
1535- password , _ := ctx .Value (fn.PushPasswordKey {}).(string )
1536-
1537- if username != testUser || password != testPass {
1538- t .Fatalf ("expected username %q, password %q. Got %q, %q" , testUser , testPass , username , password )
1539- }
1540-
1541- return "" , nil
1542- }
1543-
1544- cmd := cmdFn (NewTestClient (fn .WithPusher (pusher )))
1545- cmd .SetArgs ([]string {"--builder" , "host" , "--username" , testUser , "--password" , testPass })
1546- if err := cmd .Execute (); err != nil {
1547- t .Fatal (err )
1548- }
1549-
1550- // Basic Auth: token
1551- // -----------------------------
1552- pusher = mock .NewPusher ()
1553- pusher .PushFn = func (ctx context.Context , _ fn.Function ) (string , error ) {
1554- token , _ := ctx .Value (fn.PushTokenKey {}).(string )
1555-
1556- if token != testToken {
1557- t .Fatalf ("expected token %q, got %q" , testToken , token )
1558- }
1559-
1560- return "" , nil
1561- }
1562-
1563- cmd = cmdFn (NewTestClient (fn .WithPusher (pusher )))
1564-
1565- cmd .SetArgs ([]string {"--builder" , "host" , "--token" , testToken })
1566- if err := cmd .Execute (); err != nil {
1567- t .Fatal (err )
1568- }
1569-
1570- }
1571-
15721504// TestDeploy_RemoteBuildURLPermutations ensures that the remote, build and git-url flags
15731505// are properly respected for all permutations, including empty.
15741506func TestDeploy_RemoteBuildURLPermutations (t * testing.T ) {
0 commit comments