I have different value for test$pval and and other.pval that should return the same log-rank test p-value, no ? 

    surv_object <- Surv(time = as.numeric(final_group_annotated[,time]), event = final_group_annotated[,opt$endPoint] )it1 <- survfit(surv_object ~ group, data = final_group_annotated)
    
    test=surv_pvalue(fit1, final_group_annotated)
    print(test$pval)

>   0.3427874

    
    fit.coxph <- coxph(surv_object ~ group, data = final_group_annotated)
    print(summary(fit.coxph))

    coxph(formula = surv_object ~ group, data = final_group_annotated)
    
      n= 188, number of events= 30
    
                   coef exp(coef) se(coef)      z Pr(>|z|)
    groupgroup2 -0.3482    0.7060   0.3689 -0.944    0.345
    
                exp(coef) exp(-coef) lower .95 upper .95
    groupgroup2     0.706      1.417    0.3426     1.455
    
    Concordance= 0.538  (se = 0.049 )
    Likelihood ratio test= 0.87  on 1 df,   p=0.4
    Wald test            = 0.89  on 1 df,   p=0.3
    Score (logrank) test = 0.9  on 1 df,   p=0.3

    other.pval <- coef(summary(fit.coxph))[,5]
    print(other.pval)

>  0.3452066

The p-value returned by `Surv()` is the log-rank p-value from the score test; so, you should be comparing this to the log-rank p-value from the Cox PH model. I went over this recently in this thread: https://www.biostars.org/p/401657/#401759

------------------------------------
------------

The way that you are doing it, i.e.:

    coef(summary(fit.coxph))[,5]

This will return multiple p-values when there are multiple strata, one p-value representing a single stratum / coefficient compared to the reference stratum.

To extract the log-rank p-value for the overall model, you need to use:

    summary(coxfit)$sctest[3]

Kevin